pub enum WhConstraint {
Between(f32, f32),
EqualTo(f32),
Unconstrained,
}Variants§
Between(f32, f32)
between min, max
EqualTo(f32)
Value needs to be exactly X
Unconstrained
Value can be anything
Implementations§
Source§impl WhConstraint
impl WhConstraint
Sourcepub fn min_needed_space(&self) -> Option<f32>
pub fn min_needed_space(&self) -> Option<f32>
Returns the minimum value or 0 on Unconstrained
(warning: this might not be what you want)
Sourcepub fn max_available_space(&self) -> Option<f32>
pub fn max_available_space(&self) -> Option<f32>
Returns the maximum space until the constraint is violated - returns
None if the constraint is unbounded
Sourcepub fn is_fixed_constraint(&self) -> bool
pub fn is_fixed_constraint(&self) -> bool
Returns if this WhConstraint is an EqualTo constraint
pub fn calculate_from_relative_parent(&self, relative_parent_width: f32) -> f32
Trait Implementations§
Source§impl Clone for WhConstraint
impl Clone for WhConstraint
Source§fn clone(&self) -> WhConstraint
fn clone(&self) -> WhConstraint
Returns a duplicate 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 WhConstraint
impl Debug for WhConstraint
Source§impl Default for WhConstraint
impl Default for WhConstraint
Source§impl PartialEq for WhConstraint
impl PartialEq for WhConstraint
impl Copy for WhConstraint
impl StructuralPartialEq for WhConstraint
Auto Trait Implementations§
impl Freeze for WhConstraint
impl RefUnwindSafe for WhConstraint
impl Send for WhConstraint
impl Sync for WhConstraint
impl Unpin for WhConstraint
impl UnwindSafe for WhConstraint
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more