Struct mentat_ffi::utils::error::ExternError
[−]
[src]
Represents an error that occurred on the mentat side. Many mentat FFI functions take a
*mut ExternError
as the last argument. This is an out parameter that indicates an
error that occurred during that function's execution (if any).
For functions that use this pattern, if the ExternError's message property is null, then no error occurred. If the message is non-null then it contains a string description of the error that occurred.
Important: This message is allocated on the heap and it is the consumer's responsibility to
free it using destroy_mentat_string
!
While this pattern is not ergonomic in Rust, it offers two main benefits:
- It avoids defining a large number of
Result
-shaped types in the FFI consumer, as would be required with something like anstruct ExternResult<T> { ok: *mut T, err:... }
- It offers additional type safety over
struct ExternResult { ok: *mut c_void, err:... }
, which helps avoid memory safety errors.
Fields
message: *mut c_char
Trait Implementations
impl Debug for ExternError
[src]
impl Debug for ExternError
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for ExternError
[src]
impl Default for ExternError
fn default() -> ExternError
[src]
fn default() -> ExternError
Returns the "default value" for a type. Read more
Auto Trait Implementations
impl !Send for ExternError
impl !Send for ExternError
impl !Sync for ExternError
impl !Sync for ExternError