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

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]

[src]

impl FileSize for u8
[src]

[src]

impl FileSize for u16
[src]

[src]

impl FileSize for u32
[src]

[src]

impl FileSize for u64
[src]

[src]

impl FileSize for isize
[src]

[src]

impl FileSize for i8
[src]

[src]

impl FileSize for i16
[src]

[src]

impl FileSize for i32
[src]

[src]

impl FileSize for i64
[src]

[src]

Implementors