Struct alpm_types::CompressedSize
source · pub struct CompressedSize { /* private fields */ }Expand description
Compressed size of a file (in bytes)
Examples
use alpm_types::{CompressedSize, Error};
use std::str::FromStr;
// create CompressedSize from &str
assert_eq!(
CompressedSize::from_str("1"),
Ok(CompressedSize::new(1))
);
assert_eq!(
CompressedSize::from_str("-1"),
Err(Error::InvalidCompressedSize(String::from("-1")))
);
// format as String
assert_eq!("1", format!("{}", CompressedSize::new(1)));Implementations§
source§impl CompressedSize
impl CompressedSize
sourcepub fn new(size: u64) -> CompressedSize
pub fn new(size: u64) -> CompressedSize
Create a new CompressedSize
Trait Implementations§
source§impl Clone for CompressedSize
impl Clone for CompressedSize
source§fn clone(&self) -> CompressedSize
fn clone(&self) -> CompressedSize
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 CompressedSize
impl Debug for CompressedSize
source§impl Display for CompressedSize
impl Display for CompressedSize
source§impl FromStr for CompressedSize
impl FromStr for CompressedSize
source§impl PartialEq<CompressedSize> for CompressedSize
impl PartialEq<CompressedSize> for CompressedSize
source§fn eq(&self, other: &CompressedSize) -> bool
fn eq(&self, other: &CompressedSize) -> bool
This method tests for
self and other values to be equal, and is used
by ==.