Struct comprexor::ArchiveInfo
source · pub struct ArchiveInfo { /* private fields */ }
Implementations§
source§impl ArchiveInfo
impl ArchiveInfo
sourcepub fn input_size(&self) -> u64
pub fn input_size(&self) -> u64
Get the input size without formatting
sourcepub fn input_size_formatted(&self) -> String
pub fn input_size_formatted(&self) -> String
Get the input size in a human readable format
Example
use comprexor::ArchiveInfo;
let archive_data = ArchiveInfo {
input_size: 1000,
output_size: 1000,
ratio: 1.0,
};
assert_eq!(archive_data.input_size_formatted(), "1.0 kB");
sourcepub fn output_size(&self) -> u64
pub fn output_size(&self) -> u64
Get the output size without formatting
sourcepub fn output_size_formatted(&self) -> String
pub fn output_size_formatted(&self) -> String
Get the output size in a human readable format
Example
use comprexor::ArchiveInfo;
let archive_data = ArchiveInfo {
input_size: 1000,
output_size: 1000,
ratio: 1.0,
};
assert_eq!(archive_data.output_size_formatted(), "1.0 kB");
sourcepub fn ratio_formatted(&self, num_decimals: u8) -> String
pub fn ratio_formatted(&self, num_decimals: u8) -> String
Get the ratio formatted to the given number of decimals
Example
use comprexor::ArchiveInfo;
let archive_data = ArchiveInfo {
input_size: 1000,
output_size: 1000,
ratio: 1.0,
};
assert_eq!(archive_data.ratio_formatted(5), "1.00000");
assert_eq!(archive_data.ratio_formatted(2), "1.00");
Trait Implementations§
source§impl Clone for ArchiveInfo
impl Clone for ArchiveInfo
source§fn clone(&self) -> ArchiveInfo
fn clone(&self) -> ArchiveInfo
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ArchiveInfo
impl Debug for ArchiveInfo
source§impl PartialEq<ArchiveInfo> for ArchiveInfo
impl PartialEq<ArchiveInfo> for ArchiveInfo
source§fn eq(&self, other: &ArchiveInfo) -> bool
fn eq(&self, other: &ArchiveInfo) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<ArchiveInfo> for ArchiveInfo
impl PartialOrd<ArchiveInfo> for ArchiveInfo
source§fn partial_cmp(&self, other: &ArchiveInfo) -> Option<Ordering>
fn partial_cmp(&self, other: &ArchiveInfo) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl StructuralPartialEq for ArchiveInfo
Auto Trait Implementations§
impl RefUnwindSafe for ArchiveInfo
impl Send for ArchiveInfo
impl Sync for ArchiveInfo
impl Unpin for ArchiveInfo
impl UnwindSafe for ArchiveInfo
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more