pub struct Code { /* private fields */ }Expand description
An error code of any ErrorCode type, with that type erased.
Two codes are equal when they are the same value of the same type: code
1 of one enum never equals code 1 of another. Code::get gives the
typed code back.
use protocontract::{Code, RuntimeCode};
let code = Code::of(RuntimeCode::Panicked);
assert!(code.is(RuntimeCode::Panicked));
assert_eq!(code.get::<RuntimeCode>(), Some(RuntimeCode::Panicked));
assert_eq!(code.to_string(), "PANICKED");Implementations§
Trait Implementations§
impl Copy for Code
impl Eq for Code
Auto Trait Implementations§
impl Freeze for Code
impl RefUnwindSafe for Code
impl Send for Code
impl Sync for Code
impl Unpin for Code
impl UnsafeUnpin for Code
impl UnwindSafe for Code
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