pub enum FormatArg<'a> {
Ref(&'a dyn FormatValue),
Str(&'a str),
}Expand description
A format argument - either a trait object reference or a &str slice.
Two variants handle the str unsized coercion gap: &T where T: Sized
can coerce to &dyn FormatValue directly, but &str cannot since str
is unsized. The Str variant stores the &str directly so that callers
can pass string literals without extra & indirection.
Variants§
Ref(&'a dyn FormatValue)
A reference to any sized FormatValue.
Str(&'a str)
A string slice (avoids the unsized coercion issue).
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for FormatArg<'a>
impl<'a> !Send for FormatArg<'a>
impl<'a> !Sync for FormatArg<'a>
impl<'a> !UnwindSafe for FormatArg<'a>
impl<'a> Freeze for FormatArg<'a>
impl<'a> Unpin for FormatArg<'a>
impl<'a> UnsafeUnpin for FormatArg<'a>
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