pub struct HeadRatio { /* private fields */ }Expand description
Ratio of available content budget assigned to the head portion.
Implementations§
Source§impl HeadRatio
impl HeadRatio
Sourcepub const fn new(numerator: u32, denominator: u32) -> Self
pub const fn new(numerator: u32, denominator: u32) -> Self
Construct a ratio from a numerator and denominator.
Sourcepub const fn from_percent(percent: u32) -> Self
pub const fn from_percent(percent: u32) -> Self
Construct a ratio from a percentage (0..=100).
Sourcepub const fn from_permille(permille: u32) -> Self
pub const fn from_permille(permille: u32) -> Self
Construct a ratio from parts per thousand (0..=1000).
Sourcepub fn from_f64(ratio: f64) -> Self
pub fn from_f64(ratio: f64) -> Self
Construct a ratio from a floating point value in [0.0, 1.0].
Sourcepub fn compute_head_budget(&self, total_budget: usize) -> usize
pub fn compute_head_budget(&self, total_budget: usize) -> usize
Compute the portion of total_budget assigned to the head.
Trait Implementations§
impl Copy for HeadRatio
impl Eq for HeadRatio
impl StructuralPartialEq for HeadRatio
Auto Trait Implementations§
impl Freeze for HeadRatio
impl RefUnwindSafe for HeadRatio
impl Send for HeadRatio
impl Sync for HeadRatio
impl Unpin for HeadRatio
impl UnsafeUnpin for HeadRatio
impl UnwindSafe for HeadRatio
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.