struct ErrorVariant {
name: Ident,
fields: Vec<Ident>,
has_location: bool,
has_source: bool,
has_external_cause: bool,
display: TokenStream,
span: Span,
cfg_attr: Option<Attribute>,
}
Fields§
§name: Ident
§fields: Vec<Ident>
§has_location: bool
§has_source: bool
§has_external_cause: bool
§display: TokenStream
§span: Span
§cfg_attr: Option<Attribute>
Implementations§
source§impl ErrorVariant
impl ErrorVariant
sourcefn from_enum_variant(variant: Variant) -> Self
fn from_enum_variant(variant: Variant) -> Self
Construct self from Variant
sourcefn to_debug_match_arm(&self) -> TokenStream2
fn to_debug_match_arm(&self) -> TokenStream2
Convert self into an match arm that will be used in build_debug_impl.
The generated match arm will be like:
ⓘ
ErrorKindWithSource { source, .. } => {
debug_fmt(source, layer + 1, buf);
},
ErrorKindWithoutSource { .. } => {
buf.push(format!("{layer}: {}, at {}", format!(#display), location)));
}
The generated code assumes fn debug_fmt
, var layer
, var buf
are in scope.
sourcefn to_next_match_arm(&self) -> TokenStream2
fn to_next_match_arm(&self) -> TokenStream2
Convert self into an match arm that will be used in build_next_impl.
The generated match arm will be like:
ⓘ
ErrorKindWithSource { source, .. } => {
Some(source)
},
ErrorKindWithoutSource { .. } => {
None
}
Trait Implementations§
source§impl Clone for ErrorVariant
impl Clone for ErrorVariant
source§fn clone(&self) -> ErrorVariant
fn clone(&self) -> ErrorVariant
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ErrorVariant
impl RefUnwindSafe for ErrorVariant
impl !Send for ErrorVariant
impl !Sync for ErrorVariant
impl Unpin for ErrorVariant
impl UnwindSafe for ErrorVariant
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)