pub struct Argument<'a> {
value: &'a Opaque,
formatter: fn(_: &Opaque, _: &mut Formatter<'_>) -> Result,
}
🔬This is a nightly-only experimental API. (
fmt_internals
)Expand description
This struct represents the generic “argument” which is taken by format_args!(). It contains a function to format the given value. At compile time it is ensured that the function and the value have the correct types, and then this struct is used to canonicalize arguments to one type.
Argument is essentially an optimized partially applied formatting function,
equivalent to exists T.(&T, fn(&T, &mut Formatter<'_>) -> Result
.
Fields§
§value: &'a Opaque
🔬This is a nightly-only experimental API. (
§fmt_internals
)formatter: fn(_: &Opaque, _: &mut Formatter<'_>) -> Result
🔬This is a nightly-only experimental API. (
fmt_internals
)Implementations§
source§impl<'a> Argument<'a>
impl<'a> Argument<'a>
fn new<'b, T>( x: &'b T, f: fn(_: &T, _: &mut Formatter<'_>) -> Result ) -> Argument<'b>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub fn new_display<'b, T: Display>(x: &'b T) -> Argument<'_>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub fn new_debug<'b, T: Debug>(x: &'b T) -> Argument<'_>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub fn new_octal<'b, T: Octal>(x: &'b T) -> Argument<'_>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub fn new_lower_hex<'b, T: LowerHex>(x: &'b T) -> Argument<'_>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub fn new_upper_hex<'b, T: UpperHex>(x: &'b T) -> Argument<'_>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub fn new_pointer<'b, T: Pointer>(x: &'b T) -> Argument<'_>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub fn new_binary<'b, T: Binary>(x: &'b T) -> Argument<'_>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub fn new_lower_exp<'b, T: LowerExp>(x: &'b T) -> Argument<'_>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub fn new_upper_exp<'b, T: UpperExp>(x: &'b T) -> Argument<'_>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub fn from_usize(x: &usize) -> Argument<'_>
🔬This is a nightly-only experimental API. (
fmt_internals
)pub(super) fn fmt(&self, f: &mut Formatter<'_>) -> Result
🔬This is a nightly-only experimental API. (
fmt_internals
)pub(super) fn as_usize(&self) -> Option<usize>
🔬This is a nightly-only experimental API. (
fmt_internals
)Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Argument<'a>
impl<'a> !RefUnwindSafe for Argument<'a>
impl<'a> !Send for Argument<'a>
impl<'a> !Sync for Argument<'a>
impl<'a> Unpin for Argument<'a>
impl<'a> !UnwindSafe for Argument<'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