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§
Sourcefn get_si_parts(&self) -> (String, &'static str)
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)
Sourcefn get_iec_parts(&self) -> (String, &'static str)
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§
Sourcefn to_si_string(&self) -> String
fn to_si_string(&self) -> String
Returns a formatted string in SI (base-1000) standard
返回 SI (base-1000) 标准的格式化字符串
Sourcefn to_iec_string(&self) -> String
fn to_iec_string(&self) -> String
Returns a formatted string in IEC (base-1024) standard
返回 IEC (base-1024) 标准的格式化字符串