pub struct ErrorDescriptor {
pub name: &'static str,
pub code: u32,
pub invariant: &'static str,
pub doc: &'static str,
}Expand description
Descriptor for one variant of a #[hopper::error] enum.
Carried in the program manifest so off-chain SDKs can map numeric error
codes back to names and. via invariant. to the safety check that
produced them.
§Design notes
Hopper errors can carry the invariant name a variant corresponds
to, so a client that sees error 0x1001 can surface “Invariant
balance_nonzero failed” without needing to keep a separate lookup
table in sync with the on-chain code.
Fields§
§name: &'static strVariant name (exactly as declared).
code: u32Stable numeric code emitted on failure.
invariant: &'static strInvariant this error corresponds to, or empty string if none.
doc: &'static strShort documentation string (often copied from variant doc comments).
Trait Implementations§
Source§impl Clone for ErrorDescriptor
impl Clone for ErrorDescriptor
Source§fn clone(&self) -> ErrorDescriptor
fn clone(&self) -> ErrorDescriptor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorDescriptor
impl Debug for ErrorDescriptor
Source§impl PartialEq for ErrorDescriptor
impl PartialEq for ErrorDescriptor
Source§fn eq(&self, other: &ErrorDescriptor) -> bool
fn eq(&self, other: &ErrorDescriptor) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for ErrorDescriptor
impl Eq for ErrorDescriptor
impl StructuralPartialEq for ErrorDescriptor
Auto Trait Implementations§
impl Freeze for ErrorDescriptor
impl RefUnwindSafe for ErrorDescriptor
impl Send for ErrorDescriptor
impl Sync for ErrorDescriptor
impl Unpin for ErrorDescriptor
impl UnsafeUnpin for ErrorDescriptor
impl UnwindSafe for ErrorDescriptor
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