Trait sprintf::Printf

source ·
pub trait Printf {
    // Required methods
    fn format(&self, spec: &ConversionSpecifier) -> Result<String>;
    fn as_int(&self) -> Option<i32>;
}
Expand description

Trait for types that can be formatted using printf strings

Implemented for the basic types and shouldn’t need implementing for anything else.

Required Methods§

source

fn format(&self, spec: &ConversionSpecifier) -> Result<String>

Format self based on the conversion configured in spec.

source

fn as_int(&self) -> Option<i32>

Get self as an integer for use as a field width, if possible.

Implementations on Foreign Types§

source§

impl Printf for u8

source§

impl Printf for i8

source§

impl Printf for &str

source§

impl Printf for String

source§

impl Printf for i16

source§

impl Printf for u32

source§

impl Printf for u64

source§

impl Printf for f64

source§

impl Printf for i32

source§

impl Printf for isize

source§

impl Printf for f32

source§

impl Printf for u16

source§

impl Printf for i64

source§

impl Printf for usize

source§

impl Printf for char

Implementors§