Trait humansize::FileSize [] [src]

pub trait FileSize {
    fn file_size(&self, opts: FileSizeOpts) -> Result<String, String>;
}

The trait for the file_sizemethod

Required Methods

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 if called on a negative number

Examples

use humansize::{FileSize, file_size_opts as options};

let size = 5128;
println!("Size is {}", size.file_size(options::DECIMAL).unwrap());

Implementors