pub struct ErrorRegistry {
pub enum_name: &'static str,
pub errors: &'static [ErrorDescriptor],
}Expand description
A convenience wrapper holding an enum’s full error table.
Programs expose their error tables to the schema via the SchemaExport
path; the manifest gains an errors[] field that aggregates across all
such registries declared in the crate.
Fields§
§enum_name: &'static strEnum ident, e.g. "VaultError".
errors: &'static [ErrorDescriptor]Ordered error descriptors.
Implementations§
Source§impl ErrorRegistry
impl ErrorRegistry
Sourcepub fn find_by_code(&self, code: u32) -> Option<&ErrorDescriptor>
pub fn find_by_code(&self, code: u32) -> Option<&ErrorDescriptor>
Look up an error descriptor by numeric code.
Sourcepub fn invariant_for(&self, code: u32) -> Option<&'static str>
pub fn invariant_for(&self, code: u32) -> Option<&'static str>
Look up the invariant name associated with a code, if any.
Trait Implementations§
Source§impl Clone for ErrorRegistry
impl Clone for ErrorRegistry
Source§fn clone(&self) -> ErrorRegistry
fn clone(&self) -> ErrorRegistry
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 ErrorRegistry
impl Debug for ErrorRegistry
impl Copy for ErrorRegistry
Auto Trait Implementations§
impl Freeze for ErrorRegistry
impl RefUnwindSafe for ErrorRegistry
impl Send for ErrorRegistry
impl Sync for ErrorRegistry
impl Unpin for ErrorRegistry
impl UnsafeUnpin for ErrorRegistry
impl UnwindSafe for ErrorRegistry
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