Struct alloc::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