pub struct FormatError(/* private fields */);Expand description
An error returned by formatting operations.
This can hold any error, allowing plugins to return their own error types,
while still implementing std::error::Error so that consumers can convert
it into their own error type.
Implementations§
Source§impl FormatError
impl FormatError
Sourcepub fn new(error: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self
pub fn new(error: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self
Creates a new error from anything that can be turned into a boxed error
(for example a String, &str, or any std::error::Error).
Sourcepub fn downcast_ref<E: Error + 'static>(&self) -> Option<&E>
pub fn downcast_ref<E: Error + 'static>(&self) -> Option<&E>
Attempts to downcast the underlying error to a concrete type
(ex. to check for a CriticalFormatError).
Trait Implementations§
Source§impl Debug for FormatError
impl Debug for FormatError
Source§impl Display for FormatError
impl Display for FormatError
Source§impl Error for FormatError
impl Error for FormatError
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 From<&str> for FormatError
impl From<&str> for FormatError
Source§impl From<CriticalFormatError> for FormatError
impl From<CriticalFormatError> for FormatError
Source§fn from(error: CriticalFormatError) -> Self
fn from(error: CriticalFormatError) -> Self
Converts to this type from the input type.
Source§impl From<Error> for FormatError
impl From<Error> for FormatError
Source§impl From<Error> for FormatError
impl From<Error> for FormatError
Source§impl From<FromUtf8Error> for FormatError
impl From<FromUtf8Error> for FormatError
Source§fn from(error: FromUtf8Error) -> Self
fn from(error: FromUtf8Error) -> Self
Converts to this type from the input type.
Source§impl From<JoinError> for FormatError
impl From<JoinError> for FormatError
Source§impl From<RecvError> for FormatError
impl From<RecvError> for FormatError
Auto Trait Implementations§
impl !RefUnwindSafe for FormatError
impl !UnwindSafe for FormatError
impl Freeze for FormatError
impl Send for FormatError
impl Sync for FormatError
impl Unpin for FormatError
impl UnsafeUnpin for FormatError
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