Struct StdFmtWrite
pub struct StdFmtWrite<W>(pub W);
An adapter for using std::fmt::Write implementations with fmt::Write.
This is useful when one wants to format a datetime or span directly
to something with a std::fmt::Write trait implementation but not a
fmt::Write implementation.
(Despite using Std in this name, this type is available in core-only
configurations.)
Example
This example shows the std::fmt::Display trait implementation for
civil::DateTime (but using a wrapper type).
use ;
;
let dt = MyDateTime;
assert_eq!;
Fields
0: W
Trait Implementations
impl<W: Clone> Clone for StdFmtWrite<W>
fn clone(&self) -> StdFmtWrite<W>
impl<W: Debug> Debug for StdFmtWrite<W>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<W: Write> Write for StdFmtWrite<W>
fn write_str(&mut self, string: &str) -> Result<(), Error>
impl<W: Write> Write for StdFmtWrite<W>
fn write_str(&mut self, string: &str) -> Result<(), Error>
Auto Trait Implementations
impl<W> Freeze for StdFmtWrite<W>
where
W: Freeze,
impl<W> RefUnwindSafe for StdFmtWrite<W>
where
W: RefUnwindSafe,
impl<W> Send for StdFmtWrite<W>
where
W: Send,
impl<W> Sync for StdFmtWrite<W>
where
W: Sync,
impl<W> Unpin for StdFmtWrite<W>
where
W: Unpin,
impl<W> UnsafeUnpin for StdFmtWrite<W>
where
W: UnsafeUnpin,
impl<W> UnwindSafe for StdFmtWrite<W>
where
W: UnwindSafe,
Blanket Implementations
impl<T> Any for StdFmtWrite<W>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for StdFmtWrite<W>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for StdFmtWrite<W>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for StdFmtWrite<W>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for StdFmtWrite<W>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for StdFmtWrite<W>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for StdFmtWrite<W>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for StdFmtWrite<W>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for StdFmtWrite<W>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>