pub struct OutOf {
pub part: f64,
pub total: f64,
}
Expand description
Compute and display fractions.
use fuser_async::utils::OutOf;
let r = OutOf::new(1, 3);
assert_eq!(format!("{:.1}", r), "33.3%");
assert_eq!(format!("{:.0}", r), "33%");
Fields§
§part: f64
§total: f64
Implementations§
Source§impl OutOf
impl OutOf
pub fn new<A: AsPrimitive<f64>, B: AsPrimitive<f64>>(part: A, total: B) -> Self
pub fn perc(&self) -> f64
pub fn display_full(&self) -> String
Trait Implementations§
Source§impl AsPrimitive<f64> for OutOf
impl AsPrimitive<f64> for OutOf
Source§impl<'de> Deserialize<'de> for OutOf
impl<'de> Deserialize<'de> for OutOf
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for OutOf
Auto Trait Implementations§
impl Freeze for OutOf
impl RefUnwindSafe for OutOf
impl Send for OutOf
impl Sync for OutOf
impl Unpin for OutOf
impl UnwindSafe for OutOf
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