Struct Argument
#[repr(align(2))]
pub struct Argument<'a> { pub(in ::fmt::rt) ty: ArgumentType<'a> }
This struct represents a generic "argument" which is taken by format_args!().
This can be either a placeholder argument or a count argument.
- A placeholder argument 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.
Placeholder arguments are essentially an optimized partially applied formatting
function, equivalent to
exists T.(&T, fn(&T, &mut Formatter<'_>) -> Result. - A count argument contains a count for dynamic formatting parameters like precision and width.
Fields
ty: ArgumentType<'a>
Implementations
impl Argument<'_>
const fn new_display<T: Display>(x: &T) -> Argument<'_>const fn new_debug<T: Debug>(x: &T) -> Argument<'_>const fn new_debug_noop<T: Debug>(x: &T) -> Argument<'_>const fn new_octal<T: Octal>(x: &T) -> Argument<'_>const fn new_lower_hex<T: LowerHex>(x: &T) -> Argument<'_>const fn new_upper_hex<T: UpperHex>(x: &T) -> Argument<'_>const fn new_pointer<T: Pointer>(x: &T) -> Argument<'_>const fn new_binary<T: Binary>(x: &T) -> Argument<'_>const fn new_lower_exp<T: LowerExp>(x: &T) -> Argument<'_>const fn new_upper_exp<T: UpperExp>(x: &T) -> Argument<'_>const fn from_usize(x: &usize) -> Argument<'_>unsafe fn fmt(&self, f: &mut Formatter<'_>) -> ResultFormat this placeholder argument.
Safety
This argument must actually be a placeholder argument.
const fn as_u16(&self) -> Option<u16>
Trait Implementations
impl<'a> Clone for Argument<'a>
fn clone(&self) -> Argument<'a>
impl<'a> Copy for Argument<'a>
impl<'a> TrivialClone for Argument<'a>
Auto Trait Implementations
impl<'a> !Send for Argument<'a>
impl<'a> !Sync for Argument<'a>
impl<'a> Freeze for Argument<'a>
impl<'a> RefUnwindSafe for Argument<'a>
impl<'a> Unpin for Argument<'a>
impl<'a> UnsafeUnpin for Argument<'a>
impl<'a> UnwindSafe for Argument<'a>
Blanket Implementations
impl<T> Any for Argument<'a>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Argument<'a>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Argument<'a>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Argument<'a>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Argument<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Argument<'a>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Argument<'a>
impl<T, U> Into<U> for Argument<'a>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Argument<'a>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Argument<'a>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>