# Type Alias alloc::fmt::Result

1.0.0 · source ·

    pub type Result = Result<(), Error>;

Expand description

The type returned by formatter methods.

## Examples

    use std::fmt;

    #[derive(Debug)]
    struct Triangle {
        a: f32,
        b: f32,
        c: f32
    }

    impl fmt::Display for Triangle {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            write!(f, "({}, {}, {})", self.a, self.b, self.c)
        }
    }

    let pythagorean_triple = Triangle { a: 3.0, b: 4.0, c: 5.0 };

    assert_eq!(format!("{pythagorean_triple}"), "(3, 4, 5)");

Run

## Aliased Type§

    enum Result {
        Ok(()),
        Err(Error),
    }

## Variants§

§

### Ok(())

Contains the success value

§

### Err(Error)

Contains the error value

## Trait Implementations§

source§

### impl<T, E> Debug for Result<T, E>where T: Debug, E: Debug,

source§

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

Formats the value using the given formatter. Read more