Trait fast_fmt::Fmt
[−]
[src]
pub trait Fmt<S = Display> { fn fmt<W: Write>(
&self,
writer: &mut W,
strategy: &S
) -> Result<(), W::Error>; fn size_hint(&self, strategy: &S) -> usize; fn transformed<T: Transform>(
self,
transformation: T
) -> Transformed<Self, T>
where
Self: Sized, { ... } }
The formatting trait. Represents types that can be formated.
This trait is much like core::fmt::Display
, core::fmt::Debug
and other similar traits from
core::fmt
, but instead of many traits it is a single parametrized trait.
The S
type parameter is formatting strategy and it defaults to Display
.
Required Methods
fn fmt<W: Write>(&self, writer: &mut W, strategy: &S) -> Result<(), W::Error>
The implementor should write itself into writer
inside this function.
fn size_hint(&self, strategy: &S) -> usize
The implementor should estimate how many bytes would it's representation have in UTF-8 if formated using specific strategy.
If the implementor knows maximum possible size, it should return it. If the implementor doesn't know maximum possible size, it should return minimum possible size. (0 is always valid minimum)
Provided Methods
fn transformed<T: Transform>(self, transformation: T) -> Transformed<Self, T> where
Self: Sized,
Self: Sized,
Combinator for transforming the value,
Implementors
impl Fmt<Display> for i8
impl Fmt<Display> for i16
impl Fmt<Display> for i32
impl Fmt<Display> for i64
impl Fmt<Display> for u8
impl Fmt<Display> for u16
impl Fmt<Display> for u32
impl Fmt<Display> for u64
impl Fmt for String
impl<S, V: Fmt<S>, T: Transform> Fmt<S> for Transformed<V, T>
impl<'a, S, T: ?Sized + Fmt<S>> Fmt<S> for &'a T
impl<'a, S, T: Fmt<S>> Fmt for Instantiated<'a, T, S>
impl<S, T0: Fmt<S>, T1: Fmt<S>> Fmt<S> for Chain<T0, T1>
impl<S> Fmt<S> for Empty
impl Fmt<Display> for str
impl Fmt<Display> for char