pub struct FileSize { /* private fields */ }Expand description
Implementations§
Source§impl FileSize
impl FileSize
Sourcepub fn new(bytes: NonZeroU64, standard: SizeStandard) -> Self
pub fn new(bytes: NonZeroU64, standard: SizeStandard) -> Self
Create a new FileSize instance
创建一个新的 FileSize 实例
Sourcepub fn get_nonzero(&self) -> NonZeroU64
pub fn get_nonzero(&self) -> NonZeroU64
Get the inner NonZeroU64 byte value
获取内部的 NonZeroU64 字节值
Sourcepub fn get_si_parts(&self) -> (String, &'static str)
pub fn get_si_parts(&self) -> (String, &'static str)
Returns the formatted value and unit in SI (base-1000) standard
The formatted_value is returned as String to ensure correct decimal places (e.g., “1.00”)
返回 SI (base-1000) 标准的 (formatted_value, unit)
formatted_value 作为 String 返回,以保证正确的小数位数 (例如 “1.00”)
Sourcepub fn get_iec_parts(&self) -> (String, &'static str)
pub fn get_iec_parts(&self) -> (String, &'static str)
Returns the formatted value and unit in IEC (base-1024) standard
The formatted_value is returned as String to ensure correct decimal places (e.g., “1.00”)
返回 IEC (base-1024) 标准的 (formatted_value, unit)
formatted_value 作为 String 返回,以保证正确的小数位数 (例如 “1.00”)
Trait Implementations§
Source§impl Display for FileSize
Implement Display trait for smart formatting
impl Display for FileSize
Implement Display trait for smart formatting
实现 Display trait 来处理智能格式化
Source§impl PartialOrd for FileSize
impl PartialOrd for FileSize
impl Copy for FileSize
Auto Trait Implementations§
impl Freeze for FileSize
impl RefUnwindSafe for FileSize
impl Send for FileSize
impl Sync for FileSize
impl Unpin for FileSize
impl UnwindSafe for FileSize
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more