Trait xpct::core::Format

source ·
pub trait Format {
    type Value;

    // Required method
    fn fmt(&self, f: &mut Formatter, value: Self::Value) -> Result<()>;
}
Expand description

A generic formatter.

Implement this trait to create custom formatters. This works similarly to std::fmt::Display, where you call methods on the Formatter to write to the output.

Required Associated Types§

source

type Value

The value to format.

Required Methods§

source

fn fmt(&self, f: &mut Formatter, value: Self::Value) -> Result<()>

Format the value.

Implementations on Foreign Types§

source§

impl<T> Format for &Twhere T: Format + ?Sized,

§

type Value = <T as Format>::Value

source§

fn fmt(&self, f: &mut Formatter, value: Self::Value) -> Result<()>

Implementors§

source§

impl Format for ByFieldFormat

source§

impl Format for FailureFormat

source§

impl Format for InfallibleFormat

source§

impl Format for SomeFailuresFormat

source§

impl Format for DefaultAssertionFormat

source§

impl<'a> Format for WhyFormat<'a>

source§

impl<Actual> Format for ExpectationFormat<Actual>where Actual: Debug,

§

type Value = MatchFailure<Expectation<Actual>, Expectation<Actual>>

source§

impl<Actual, Expected> Format for DiffFormat<Actual, Expected>where Actual: Debug, Expected: Diffable<Actual> + Debug,

Available on crate feature diff only.
source§

impl<Actual, Expected> Format for MismatchFormat<Actual, Expected>where Actual: Debug, Expected: Debug,

§

type Value = MatchFailure<Mismatch<Actual, Expected>, Mismatch<Actual, Expected>>

source§

impl<Fmt> Format for HeaderFormat<Fmt>where Fmt: Format,

§

type Value = MatchFailure<<Fmt as Format>::Value, <Fmt as Format>::Value>

source§

impl<Fmt, Pos, Neg> Format for NegFormat<Fmt>where Fmt: Format<Value = MatchFailure<Pos, Neg>>,

§

type Value = MatchFailure<Neg, Pos>

source§

impl<PosFail, NegFail> Format for MessageFormat<PosFail, NegFail>

§

type Value = MatchFailure<PosFail, NegFail>

source§

impl<PosFmt, NegFmt, PosFail, NegFail> Format for DispatchFormat<PosFmt, NegFmt>where PosFmt: Format<Value = MatchFailure<PosFail>>, NegFmt: Format<Value = MatchFailure<NegFail>>,

§

type Value = MatchFailure<PosFail, NegFail>