Re: [PATCH v2 2/6] rust: error: Add Error::to_ptr()
From: Martin Rodriguez Reboredo
Date: Wed Mar 29 2023 - 10:50:01 EST
On 3/29/23 09:04, Asahi Lina wrote:
> [...]
>
> +
> + /// Returns the error encoded as a pointer.
> + #[allow(dead_code)]
> + pub(crate) fn to_ptr<T>(self) -> *mut T {
> + // SAFETY: Valid as long as self.0 is a valid error
> + unsafe { bindings::ERR_PTR(self.0.into()) as *mut _ }
> + }
> }
>
> impl From<AllocError> for Error {
>
Reviewed-by: Martin Rodriguez Reboredo