pub struct Rangef {
pub min: f32,
pub max: f32,
}Expand description
An inclusive range of floats — one axis of a Rect.
Fields§
§min: f32§max: f32Implementations§
Source§impl Rangef
impl Rangef
Sourcepub const EVERYTHING: Self
pub const EVERYTHING: Self
-∞ to +∞, inclusive.
Sourcepub const NOTHING: Self
pub const NOTHING: Self
The inverse of Self::EVERYTHING, containing nothing.
pub const fn new(min: f32, max: f32) -> Self
pub fn center(self) -> f32
pub fn contains(self, x: f32) -> bool
pub fn clamp(self, x: f32) -> f32
Sourcepub fn as_positive(self) -> Self
pub fn as_positive(self) -> Self
Swap the ends if needed, so min <= max after.
pub fn flip(self) -> Self
Sourcepub fn intersection(self, other: Self) -> Self
pub fn intersection(self, other: Self) -> Self
The overlap of two ranges. span() < 0.0 when they do not overlap.
pub fn intersects(self, other: Self) -> bool
Trait Implementations§
Source§impl From<RangeInclusive<f32>> for Rangef
impl From<RangeInclusive<f32>> for Rangef
Source§fn from(range: RangeInclusive<f32>) -> Self
fn from(range: RangeInclusive<f32>) -> Self
Converts to this type from the input type.
impl Copy for Rangef
impl StructuralPartialEq for Rangef
Auto Trait Implementations§
impl Freeze for Rangef
impl RefUnwindSafe for Rangef
impl Send for Rangef
impl Sync for Rangef
impl Unpin for Rangef
impl UnsafeUnpin for Rangef
impl UnwindSafe for Rangef
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