pub struct Error;
Expand description
The error type which is returned from formatting a message into a stream.
This type does not support transmission of an error other than that an error occurred. Any extra information must be arranged to be transmitted through some other means.
An important thing to remember is that the type fmt::Error
should not be
confused with std::io::Error
or std::error::Error
, which you may also
have in scope.
Examples
use std::fmt::{self, write};
let mut output = String::new();
if let Err(fmt::Error) = write(&mut output, format_args!("Hello {}!", "world")) {
panic!("An error occurred");
}
RunTrait Implementations§
1.11.0 · source§impl Error for Error
impl Error for Error
source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
source§fn type_id(&self, _: Internal) -> TypeIdwhere
Self: 'static,
fn type_id(&self, _: Internal) -> TypeIdwhere Self: 'static,
🔬This is a nightly-only experimental API. (
error_type_id
#60784)Gets the
TypeId
of self
.source§impl Ord for Error
impl Ord for Error
source§impl PartialOrd<Error> for Error
impl PartialOrd<Error> for Error
impl Copy for Error
impl StructuralEq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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