Struct std::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
#117729)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'");
RunTuple Fields§
§0: F
🔬This is a nightly-only experimental API. (
debug_closure_helpers
#117729)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