Trait humansize::FileSize [−][src]
pub trait FileSize {
fn file_size<T: AsRef<FileSizeOpts>>(
&self,
opts: T
) -> Result<String, String>;
}The trait for the file_sizemethod
Required Methods
fn file_size<T: AsRef<FileSizeOpts>>(&self, opts: T) -> Result<String, String>
Formats self according to the parameters in opts. opts can either be one of the
three defaults providedby the file_size_opts module, or be custom-defined according
to your needs
Errors
Will fail by default if called on a negative number. Override this behavior by setting
allow_negative to True in a custom options struct.
Examples
use humansize::{FileSize, file_size_opts as options}; let size = 5128; println!("Size is {}", size.file_size(options::DECIMAL).unwrap());
Implementations on Foreign Types
impl FileSize for usize[src]
impl FileSize for usizeimpl FileSize for u8[src]
impl FileSize for u8impl FileSize for u16[src]
impl FileSize for u16impl FileSize for u32[src]
impl FileSize for u32impl FileSize for u64[src]
impl FileSize for u64impl FileSize for isize[src]
impl FileSize for isizeimpl FileSize for i8[src]
impl FileSize for i8impl FileSize for i16[src]
impl FileSize for i16impl FileSize for i32[src]
impl FileSize for i32impl FileSize for i64[src]
impl FileSize for i64