Module interoptopus::patterns::result
source · Expand description
For return enums with defined Ok
variants; may translate to exceptions if not met.
§Examples
Functions returning a FFIError
might receive special treatment in backends supporting
exception handling. For example, a service
method defined
as:
pub fn my_method() -> Result<(), Error> {
Ok(())
}
might receive a binding helper equivalent to:
public void MyMethod()
{
var rval = Interop.simple_service_my_method(_context);
if (rval != FFIError.Ok)
{
throw new Exception($"Something went wrong {rval}");
}
}
Structs§
- Internal helper derived for enums that are an
FFIError
.
Traits§
- A trait you should implement for enums that signal errors in FFI calls.
Functions§
- Extracts a string message from a panic unwind.