Trait interoptopus::patterns::success_enum::Success [−][src]
Expand description
A trait you should implement for enums that signal errors in FFI calls.
The SUCCESS
variant will be used to automatically convert Result::Ok
values, and NULL
when a required pointer was detected to be null
.
Example
use interoptopus::patterns::success_enum::Success; enum FFIError { Ok = 0, NullPassed = 1, Panic = 2, OtherError = 3, } impl Success for FFIError { const SUCCESS: Self = Self::Ok; const NULL: Self = Self::NullPassed; const PANIC: Self = Self::Panic; }
Associated Constants
The variant to return when everything went OK, usually the variant with value 0
.