pub struct ErrorCode(/* private fields */);
Expand description
A wrapper around error codes, which is represented identically to an i32 on the other side of the FFI. Essentially exists to check that we don’t accidentally reuse success/panic codes for other things.
Implementations§
Source§impl ErrorCode
impl ErrorCode
Sourcepub const PANIC: ErrorCode
pub const PANIC: ErrorCode
The ErrorCode used for panics. It’s unlikely you need to ever use this.
Sourcepub const INVALID_HANDLE: ErrorCode
pub const INVALID_HANDLE: ErrorCode
The ErrorCode used for handle map errors.
Sourcepub fn new(code: i32) -> Self
pub fn new(code: i32) -> Self
Construct an error code from an integer code.
§Panics
Panics if you call it with 0 (reserved for success, but you can use ErrorCode::SUCCESS
if
that’s what you want), or -1 (reserved for panics, but you can use ErrorCode::PANIC
if
that’s what you want).
Sourcepub fn is_success(self) -> bool
pub fn is_success(self) -> bool
Returns whether or not this is a success code.
Trait Implementations§
Source§impl Ord for ErrorCode
impl Ord for ErrorCode
Source§impl PartialOrd for ErrorCode
impl PartialOrd for ErrorCode
impl Copy for ErrorCode
impl Eq for ErrorCode
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Freeze for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnwindSafe for ErrorCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more