Struct dyn_fmt::Arguments

source ·
pub struct Arguments<'a, F: AsRef<str>, T: Display + ?Sized + 'a, I: IntoIterator<Item = &'a T> + Clone> { /* private fields */ }
Expand description

This structure represents a format string combined with its arguments. In contrast with fmt::Arguments this structure can be easily and safely created at runtime.

Implementations§

source§

impl<'a, F: AsRef<str>, T: Display + ?Sized + 'a, I: IntoIterator<Item = &'a T> + Clone> Arguments<'a, F, T, I>

source

pub fn new(fmt: F, args: I) -> Self

Creates a new instance of a Displayable structure, representing formatted arguments. A runtime analog of format_args! macro. Extra arguments are ignored, missing arguments are replaced by empty string.

Examples:
dyn_fmt::Arguments::new("{}a{}b{}c", &[1, 2, 3]); // "1a2b3c"
dyn_fmt::Arguments::new("{}a{}b{}c", &[1, 2, 3, 4]); // "1a2b3c"
dyn_fmt::Arguments::new("{}a{}b{}c", &[1, 2]); // "1a2bc"
dyn_fmt::Arguments::new("{{}}{}", &[1, 2]); // "{}1"

Trait Implementations§

source§

impl<'a, F: Clone + AsRef<str>, T: Clone + Display + ?Sized + 'a, I: Clone + IntoIterator<Item = &'a T> + Clone> Clone for Arguments<'a, F, T, I>

source§

fn clone(&self) -> Arguments<'a, F, T, I>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, F: Debug + AsRef<str>, T: Debug + Display + ?Sized + 'a, I: Debug + IntoIterator<Item = &'a T> + Clone> Debug for Arguments<'a, F, T, I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, F: AsRef<str>, T: Display + ?Sized + 'a, I: IntoIterator<Item = &'a T> + Clone> Display for Arguments<'a, F, T, I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, F, T: ?Sized, I> RefUnwindSafe for Arguments<'a, F, T, I>where F: RefUnwindSafe, I: RefUnwindSafe,

§

impl<'a, F, T: ?Sized, I> Send for Arguments<'a, F, T, I>where F: Send, I: Send,

§

impl<'a, F, T: ?Sized, I> Sync for Arguments<'a, F, T, I>where F: Sync, I: Sync,

§

impl<'a, F, T: ?Sized, I> Unpin for Arguments<'a, F, T, I>where F: Unpin, I: Unpin,

§

impl<'a, F, T: ?Sized, I> UnwindSafe for Arguments<'a, F, T, I>where F: UnwindSafe, I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.