Struct byte_unit::AdjustedByte
source · pub struct AdjustedByte { /* private fields */ }
Expand description
Generated from the get_appropriate_unit
and get_adjusted_unit
methods of a Byte
object.
Implementations
sourceimpl AdjustedByte
impl AdjustedByte
sourcepub fn format(&self, fractional_digits: usize) -> String
pub fn format(&self, fractional_digits: usize) -> String
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");
pub fn get_value(&self) -> f64
pub fn get_unit(&self) -> ByteUnit
Trait Implementations
sourceimpl Clone for AdjustedByte
impl Clone for AdjustedByte
sourcefn clone(&self) -> AdjustedByte
fn clone(&self) -> AdjustedByte
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for AdjustedByte
impl Debug for AdjustedByte
sourceimpl Display for AdjustedByte
impl Display for AdjustedByte
sourceimpl Hash for AdjustedByte
impl Hash for AdjustedByte
sourceimpl PartialEq<AdjustedByte> for AdjustedByte
impl PartialEq<AdjustedByte> for AdjustedByte
sourcefn eq(&self, other: &AdjustedByte) -> bool
fn eq(&self, other: &AdjustedByte) -> bool
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));
impl Copy for AdjustedByte
impl Eq for AdjustedByte
Auto Trait Implementations
impl RefUnwindSafe for AdjustedByte
impl Send for AdjustedByte
impl Sync for AdjustedByte
impl Unpin for AdjustedByte
impl UnwindSafe for AdjustedByte
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more