# 1.0.0[−][src]Struct std::fmt::Error

    pub struct Error;

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");
    }

Run

## Trait Implementations

### `impl Clone for Error`[src]

#### `fn clone(&self) -> Error`[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`[src]

Performs copy-assignment from `source`. Read more

### `impl Copy for Error`[src]

### `impl Debug for Error`[src]

#### `fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>`[src]

Formats the value using the given formatter. Read more

### `impl Default for Error`[src]

#### `fn default() -> Error`[src]

Returns the "default value" for a type. Read more

### `impl Display for Error`[src]

#### `fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>`[src]

Formats the value using the given formatter. Read more

### `impl Eq for Error`[src]

### `impl Error for Error` 1.11.0[src]

#### `fn description(&self) -> &str`[src]

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

`if let Err(e) = "xc".parse::<u32>() { // Print` e`itself, no need for description(). eprintln!("Error: {}", e); }` Read more

#### `fn source(&self) -> Option<&(dyn Error + 'static)>`1.30.0[src]

The lower-level source of this error, if any. Read more

#### `fn backtrace(&self) -> Option<&Backtrace>`[src]

🔬 This is a nightly-only experimental API. (`backtrace` #53487)

Returns a stack backtrace, if available, of where this error occurred. Read more

#### `fn cause(&self) -> Option<&dyn Error>`[src]

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

### `impl Hash for Error`[src]

#### `fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,` [src]

Feeds this value into the given [`Hasher`]. Read more

#### `fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,` 1.3.0[src]

Feeds a slice of this type into the given [`Hasher`]. Read more

### `impl Ord for Error`[src]

#### `fn cmp(&self, other: &Error) -> Ordering`[src]

This method returns an [`Ordering`] between `self` and `other`. Read more

#### `#[must_use]fn max(self, other: Self) -> Self` 1.21.0[src]

Compares and returns the maximum of two values. Read more

#### `#[must_use]fn min(self, other: Self) -> Self` 1.21.0[src]

Compares and returns the minimum of two values. Read more

#### `#[must_use]fn clamp(self, min: Self, max: Self) -> Self`[src]

🔬 This is a nightly-only experimental API. (`clamp` #44095)

Restrict a value to a certain interval. Read more

### `impl PartialEq<Error> for Error`[src]

#### `fn eq(&self, other: &Error) -> bool`[src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]fn ne(&self, other: &Rhs) -> bool`[src]

This method tests for `!=`.

### `impl PartialOrd<Error> for Error`[src]

#### `fn partial_cmp(&self, other: &Error) -> Option<Ordering>`[src]

This method returns an ordering between `self` and `other` values if one exists. Read more

#### `#[must_use]fn lt(&self, other: &Rhs) -> bool`[src]

This method tests less than (for `self` and `other`) and is used by the `<` operator. Read more

#### `#[must_use]fn le(&self, other: &Rhs) -> bool`[src]

This method tests less than or equal to (for `self` and `other`) and is used by the `<=` operator. Read more

#### `#[must_use]fn gt(&self, other: &Rhs) -> bool`[src]

This method tests greater than (for `self` and `other`) and is used by the `>` operator. Read more

#### `#[must_use]fn ge(&self, other: &Rhs) -> bool`[src]

This method tests greater than or equal to (for `self` and `other`) and is used by the `>=` operator. Read more

### `impl StructuralEq for Error`[src]

### `impl StructuralPartialEq for Error`[src]

## 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

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `fn type_id(&self) -> TypeId`[src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `fn borrow(&self) -> &Tⓘ

### Notable traits for &'_ mut F

`impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<R: Read + ?Sized, '_> Read for &'_ mut Rimpl<W: Write + ?Sized, '_> Write for &'_ mut W`
`[src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `fn borrow_mut(&mut self) -> &mut Tⓘ

### Notable traits for &'_ mut F

`impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<R: Read + ?Sized, '_> Read for &'_ mut Rimpl<W: Write + ?Sized, '_> Write for &'_ mut W`
`[src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T`[src]

#### `fn from(t: T) -> T`[src]

Performs the conversion.

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `fn into(self) -> U`[src]

Performs the conversion.

### `impl<T> ToOwned for T where
T: Clone,` [src]

#### `type Owned = T`

The resulting type after obtaining ownership.

#### `fn to_owned(&self) -> T`[src]

Creates owned data from borrowed data, usually by cloning. Read more

#### `fn clone_into(&self, target: &mut T)`[src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into` #41263)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

### `impl<T> ToString for T where
T: Display + ?Sized,` [src]

#### `default fn to_string(&self) -> String`[src]

Converts the given value to a `String`. Read more

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>`[src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.

#### `fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>`[src]

Performs the conversion.