Trait PrintfFormatter

Source
pub trait PrintfFormatter {
    const FORMAT_ARG: &'static str;
}
Expand description

Trait used to produce printf style format strings for untyped format specifiers.

The const PrintfFormatter::FORMAT_ARG is used to provide the printf format specifier (i.e. the d in %02d) for a given type in Rust. This must be const so that it can be used to build static const format strings at compile time.

Required Associated Constants§

Source

const FORMAT_ARG: &'static str

The format specifier for this type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl PrintfFormatter for &str

Source§

const FORMAT_ARG: &'static str = "s"

Source§

impl PrintfFormatter for i32

Source§

const FORMAT_ARG: &'static str = "d"

Source§

impl PrintfFormatter for u32

Source§

const FORMAT_ARG: &'static str = "u"

Implementors§