pub struct PreSerializeError {
pub kind: PreSerializeErrorKind,
pub failed_format: Option<&'static str>,
pub format_stack: Vec<&'static str>,
}Expand description
Error returned by Prepare::prepare.
failed_format identifies the innermost named format that attached
context. With the alloc feature, format_stack retains the complete
format trace.
Fields§
§kind: PreSerializeErrorKindThe underlying failure category.
failed_format: Option<&'static str>The innermost named format that reported the failure, if available.
format_stack: Vec<&'static str>Nested format names collected while propagating the error.
Implementations§
Source§impl PreSerializeError
impl PreSerializeError
Sourcepub exec fn new(kind: PreSerializeErrorKind) -> Self
pub exec fn new(kind: PreSerializeErrorKind) -> Self
Creates an error without attached format context.
Sourcepub exec fn length_too_large() -> Self
pub exec fn length_too_large() -> Self
Creates a serialized-length overflow error.
Sourcepub exec fn not_compliant(kind: ComplianceErrorKind) -> Self
pub exec fn not_compliant(kind: ComplianceErrorKind) -> Self
Creates a value-compliance error.
Sourcepub exec fn custom(msg: &'static str) -> Self
pub exec fn custom(msg: &'static str) -> Self
Creates a format-specific value-compliance error.
Sourcepub exec fn push_format(self, current_format: &'static str) -> Self
pub exec fn push_format(self, current_format: &'static str) -> Self
Adds a named format to the error’s propagation trace.
Sourcepub exec fn failed_format(&self) -> Option<&'static str>
pub exec fn failed_format(&self) -> Option<&'static str>
Returns the innermost named format that attached context.
Sourcepub exec fn format_trace(&self) -> &[&'static str]
pub exec fn format_trace(&self) -> &[&'static str]
Returns the collected format trace, or an empty slice without alloc.
Trait Implementations§
Source§impl Clone for PreSerializeError
impl Clone for PreSerializeError
Source§impl Debug for PreSerializeError
impl Debug for PreSerializeError
Source§impl Display for PreSerializeError
impl Display for PreSerializeError
Source§impl Error for PreSerializeError
Available on crate feature std only.
impl Error for PreSerializeError
Available on crate feature
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for PreSerializeError
impl PartialEq for PreSerializeError
Source§fn eq(&self, other: &PreSerializeError) -> bool
fn eq(&self, other: &PreSerializeError) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for PreSerializeError
impl StructuralPartialEq for PreSerializeError
Auto Trait Implementations§
impl Freeze for PreSerializeError
impl RefUnwindSafe for PreSerializeError
impl Send for PreSerializeError
impl Sync for PreSerializeError
impl Unpin for PreSerializeError
impl UnsafeUnpin for PreSerializeError
impl UnwindSafe for PreSerializeError
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