Struct gstd::prelude::fmt::FormatterFn
source ยท pub struct FormatterFn<F>(pub F)
where
F: Fn(&mut Formatter<'_>) -> Result<(), Error>;
๐ฌThis is a nightly-only experimental API. (
debug_closure_helpers
)Expand description
Implements fmt::Debug
and fmt::Display
using a function.
ยงExamples
#![feature(debug_closure_helpers)]
use std::fmt;
let value = 'a';
assert_eq!(format!("{}", value), "a");
assert_eq!(format!("{:?}", value), "'a'");
let wrapped = fmt::FormatterFn(|f| write!(f, "{value:?}"));
assert_eq!(format!("{}", wrapped), "'a'");
assert_eq!(format!("{:?}", wrapped), "'a'");
Tuple Fieldsยง
ยง0: F
๐ฌThis is a nightly-only experimental API. (
debug_closure_helpers
)Trait Implementationsยง
sourceยงimpl<F> Debug for FormatterFn<F>
impl<F> Debug for FormatterFn<F>
Auto Trait Implementationsยง
impl<F> Freeze for FormatterFn<F>where
F: Freeze,
impl<F> RefUnwindSafe for FormatterFn<F>where
F: RefUnwindSafe,
impl<F> Send for FormatterFn<F>where
F: Send,
impl<F> Sync for FormatterFn<F>where
F: Sync,
impl<F> Unpin for FormatterFn<F>where
F: Unpin,
impl<F> UnwindSafe for FormatterFn<F>where
F: UnwindSafe,
Blanket Implementationsยง
sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more