Struct byte_unit::AdjustedByte[][src]

pub struct AdjustedByte(_);

Generated from the get_appropriate_unit and get_adjusted_unit methods of a Byte object.

Methods

impl AdjustedByte
[src]

Format the AdjustedByte object to string.

Examples

extern crate byte_unit;

use byte_unit::{Byte, ByteUnit};

let byte = Byte::from_unit(1555f64, ByteUnit::KB).unwrap();

let result = byte.get_appropriate_unit(false).format(3);

assert_eq!(result, "1.555 MB");

Trait Implementations

impl Debug for AdjustedByte
[src]

Formats the value using the given formatter. Read more

impl PartialEq for AdjustedByte
[src]

Deal with the logical numeric equivalent.

Examples

extern crate byte_unit;

use byte_unit::{Byte, ByteUnit};

let byte1 = Byte::from_unit(1024f64, ByteUnit::KiB).unwrap();
let byte2 = Byte::from_unit(1024f64, ByteUnit::KiB).unwrap();

assert_eq!(byte1.get_appropriate_unit(false), byte2.get_appropriate_unit(true));
extern crate byte_unit;

use byte_unit::{Byte, ByteUnit};

let byte1 = Byte::from_unit(1024f64, ByteUnit::KiB).unwrap();
let byte2 = Byte::from_unit(1f64, ByteUnit::MiB).unwrap();

assert_eq!(byte1.get_appropriate_unit(true), byte2.get_appropriate_unit(false));

This method tests for !=.

impl ToString for AdjustedByte
[src]

Format the AdjustedByte object to string. The number of fractional digits is 2.

Examples

extern crate byte_unit;

use byte_unit::{Byte, ByteUnit};

let byte = Byte::from_unit(1500f64, ByteUnit::KB).unwrap();

let result = byte.get_appropriate_unit(false).to_string();

assert_eq!(result, "1.50 MB");

Auto Trait Implementations