FileSizeFormat

Trait FileSizeFormat 

Source
pub trait FileSizeFormat {
    // Required methods
    fn get_si_parts(&self) -> (String, &'static str);
    fn get_iec_parts(&self) -> (String, &'static str);

    // Provided methods
    fn to_si_string(&self) -> String { ... }
    fn to_iec_string(&self) -> String { ... }
}
Expand description

A trait for types that can be formatted as file sizes

可以格式化为文件大小的 trait

Required Methods§

Source

fn get_si_parts(&self) -> (String, &'static str)

Returns the formatted value and unit in SI (base-1000) standard

返回 SI (base-1000) 标准的 (formatted_value, unit)

Source

fn get_iec_parts(&self) -> (String, &'static str)

Returns the formatted value and unit in IEC (base-1024) standard

返回 IEC (base-1024) 标准的 (formatted_value, unit)

Provided Methods§

Source

fn to_si_string(&self) -> String

Returns a formatted string in SI (base-1000) standard

返回 SI (base-1000) 标准的格式化字符串

Source

fn to_iec_string(&self) -> String

Returns a formatted string in IEC (base-1024) standard

返回 IEC (base-1024) 标准的格式化字符串

Implementors§