pub struct LowerBound<T>(/* private fields */);Expand description
Lower bound of a range.
Specialization of Bound where comparisons make sense in all contexts.
Implementations§
Source§impl<T> LowerBound<T>
impl<T> LowerBound<T>
Sourcepub fn excluded(t: T) -> Self
pub fn excluded(t: T) -> Self
Constructs a new excluded lower bound.
§Example
use rangetools::LowerBound;
let b1 = LowerBound::excluded(2);
let b2 = LowerBound::excluded(3);
assert!(b1 < b2);Sourcepub fn included(t: T) -> Self
pub fn included(t: T) -> Self
Constructs a new included lower bound.
§Example
use rangetools::{LowerBound, LowerBoundedRange};
let b = LowerBound::included(2);
let r= LowerBoundedRange::from(2..);
assert_eq!(b, r.start);Sourcepub fn to_bound(self) -> Bound<T>where
T: Copy,
pub fn to_bound(self) -> Bound<T>where
T: Copy,
Get the inner bound value.
Be careful when performing operations on raw bounds, as they can have different meanings depending on their original context.
Sourcepub fn map<U, F>(self, f: F) -> LowerBound<U>where
F: FnOnce(T) -> U,
pub fn map<U, F>(self, f: F) -> LowerBound<U>where
F: FnOnce(T) -> U,
Maps a LowerBound<T> to a LowerBound<U> by applying a function to the contained value.
§Example
use rangetools::LowerBound;
let b1 = LowerBound::included(3);
let b2 = b1.map(|n| n + 1);
assert_eq!(b2, LowerBound::included(4));Trait Implementations§
Source§impl<T: Clone> Clone for LowerBound<T>
impl<T: Clone> Clone for LowerBound<T>
impl<T: Copy> Copy for LowerBound<T>
Source§impl<T: Debug> Debug for LowerBound<T>
impl<T: Debug> Debug for LowerBound<T>
impl<T: Eq> Eq for LowerBound<T>
Source§impl<T> From<Bound<T>> for LowerBound<T>
impl<T> From<Bound<T>> for LowerBound<T>
Source§impl<T: Hash> Hash for LowerBound<T>
impl<T: Hash> Hash for LowerBound<T>
Source§impl<T: Ord> Ord for LowerBound<T>
impl<T: Ord> Ord for LowerBound<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<T: PartialEq> PartialEq for LowerBound<T>
impl<T: PartialEq> PartialEq for LowerBound<T>
Source§impl<T: PartialOrd> PartialOrd for LowerBound<T>
impl<T: PartialOrd> PartialOrd for LowerBound<T>
impl<T: PartialEq> StructuralPartialEq for LowerBound<T>
Auto Trait Implementations§
impl<T> Freeze for LowerBound<T>
impl<T> RefUnwindSafe for LowerBound<T>where
Bound<T>: RefUnwindSafe,
impl<T> Send for LowerBound<T>
impl<T> Sync for LowerBound<T>
impl<T> Unpin for LowerBound<T>
impl<T> UnsafeUnpin for LowerBound<T>where
Bound<T>: UnsafeUnpin,
impl<T> UnwindSafe for LowerBound<T>where
Bound<T>: UnwindSafe,
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