Struct collections::fmt::Arguments
[−]
[src]
pub struct Arguments<'a> { pieces: &'a [&'a str], fmt: Option<&'a [Argument]>, args: &'a [ArgumentV1<'a>], }
This structure represents a safely precompiled version of a format string and its arguments. This cannot be generated at runtime because it cannot safely be done so, so no constructors are given and the fields are private to prevent modification.
The format_args!
macro will safely create an instance of this structure
and pass it to a function or closure, passed as the first argument. The
macro validates the format string at compile-time so usage of the write
and format
functions can be safely performed.
Fields
pieces | |
fmt | |
args |
Methods
impl<'a> Arguments<'a>
fn new_v1(pieces: &'a [&'a str], args: &'a [ArgumentV1<'a>]) -> Arguments<'a>
fmt_internals
): internal to format_args!
When using the format_args!() macro, this function is used to generate the Arguments structure.
fn new_v1_formatted(pieces: &'a [&'a str], args: &'a [ArgumentV1<'a>], fmt: &'a [Argument]) -> Arguments<'a>
fmt_internals
): internal to format_args!
This function is used to specify nonstandard formatting parameters.
The pieces
array must be at least as long as fmt
to construct
a valid Arguments structure. Also, any Count
within fmt
that is
CountIsParam
or CountIsNextParam
has to point to an argument
created with argumentusize
. However, failing to do so doesn't cause
unsafety, but will ignore invalid .