[−][src]Trait runtime_fmt::FormatArgs
A trait for types against which formatting specifiers may be pre-checked.
Implementations may be generated automatically using runtime-fmt-derive
and #[derive(FormatArgs)]
.
Required Methods
fn validate_name(name: &str) -> Option<usize>
Find the index within this type corresponding to the provided name.
If this function returns Some
, get_child
with the returned index
must not panic.
fn validate_index(index: usize) -> bool
Validate that a given index is within range for this type.
If this function returns true
, get_child
with the given index must
not panic.
fn get_child<F: FormatTrait + ?Sized>(
index: usize
) -> Option<fn(_: &Self, _: &mut Formatter) -> Result>
index: usize
) -> Option<fn(_: &Self, _: &mut Formatter) -> Result>
Return the formatter function for the given format trait, accepting
&Self
and using the given format trait on the value at that index.
Returns None
if the given format trait cannot format the child at
that index. Panics if the index is invalid.
fn as_usize(index: usize) -> Option<fn(_: &Self) -> &usize>
Return the value at the given index interpreted as a usize
.
Returns None
if the child at the given index cannot be interpreted
as a usize
. Panics if the index is invalid.