Added function to KiraSize to format size with B suffix.
This commit is contained in:
@@ -46,6 +46,13 @@ impl std::fmt::Display for KiraSize {
|
|||||||
|
|
||||||
impl KiraSize {
|
impl KiraSize {
|
||||||
pub const SUFFIXS: [&str; 5] = ["KB", "MB", "GB", "TB", "PB"];
|
pub const SUFFIXS: [&str; 5] = ["KB", "MB", "GB", "TB", "PB"];
|
||||||
|
|
||||||
|
/// returns size in bytes suffixed with "B" character
|
||||||
|
pub fn to_parted_bytes_str(&self)-> String {
|
||||||
|
format!("{}B", self.size_bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn new_b(size:u64) -> Self {
|
pub fn new_b(size:u64) -> Self {
|
||||||
Self { size_bytes: size }
|
Self { size_bytes: size }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user