Function mentat_ffi::utils::error::translate_result
[−]
[src]
pub unsafe fn translate_result<T, E>(
result: Result<T, E>,
error: *mut ExternError
) -> *mut T where
E: Display,
Translate Result<T, E>, into something C can understand, when T is not #[repr(C)]
- If
result
isOk(v)
, movesv
to the heap and returns a pointer to it, and setserror
to a state indicating that no error occurred (message
is null). - If
result
isErr(e)
, returns a null pointer and stores a string representing the error message (which was allocated on the heap and should eventually be freed) intoerror.message