pub struct ErrCode {
pub reason: u16,
pub detail: &'static str,
}Expand description
Static error descriptor used to construct FrozenError
§Example
use frozen_core::error::ErrCode;
const LOCK_ERR: ErrCode = frozen_core::error::ErrCode::new(0x300, "lock error");
assert_eq!(LOCK_ERR.reason, 0x300);
assert_eq!(LOCK_ERR.detail, "lock error");Fields§
§reason: u1616-bit reason code encoded into FrozenError::id
detail: &'static strShort subsystem label included in the formatted error context
Implementations§
Source§impl ErrCode
impl ErrCode
Sourcepub const fn new(reason: u16, detail: &'static str) -> Self
pub const fn new(reason: u16, detail: &'static str) -> Self
Create a new ErrCode
NOTE: This function is const, allowing error codes to be defined as compile-time constants
§Example
use frozen_core::error::ErrCode;
const LOCK_ERR: ErrCode = frozen_core::error::ErrCode::new(0x300, "lock error");
assert_eq!(LOCK_ERR.reason, 0x300);
assert_eq!(LOCK_ERR.detail, "lock error");Trait Implementations§
Auto Trait Implementations§
impl Freeze for ErrCode
impl RefUnwindSafe for ErrCode
impl Send for ErrCode
impl Sync for ErrCode
impl Unpin for ErrCode
impl UnsafeUnpin for ErrCode
impl UnwindSafe for ErrCode
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