pub struct RangeCase<T: Endpoint> { /* private fields */ }Expand description
Some functions don’t care whether their input is normalized; they
take impl Into<RangeCase<...>>.
When a function doesn’t care about normalisation and doesn’t want
ownership, it can simply accept slices &[(T, T)].
Implementations§
Source§impl<T: Endpoint> RangeCase<T>
impl<T: Endpoint> RangeCase<T>
Sourcepub fn from_vec(inner: Vec<(T, T)>) -> Self
pub fn from_vec(inner: Vec<(T, T)>) -> Self
Creates a RangeCase from a (not necessarily normalized) vector of ranges.
This operation takes constant time.
Sourcepub fn from_smallvec<const N: usize>(inner: SmallVec<[(T, T); N]>) -> Self
pub fn from_smallvec<const N: usize>(inner: SmallVec<[(T, T); N]>) -> Self
Creates a RangeCase from a (not necessarily normalized) smallvec of ranges.
This operation takes constant time.
Sourcepub fn from_slice(slice: impl AsRef<[(T, T)]>) -> Self
pub fn from_slice(slice: impl AsRef<[(T, T)]>) -> Self
Creates a RangeCase from a (not necessarily normalized) slice of ranges.
This operation takes time linear in the length of the slice.
Sourcepub fn from_range_vec(set: RangeVec<T>) -> Self
pub fn from_range_vec(set: RangeVec<T>) -> Self
Sourcepub fn into_inner(self) -> SmallVec<[(T, T); 2]>
pub fn into_inner(self) -> SmallVec<[(T, T); 2]>
Returns the underlying vector
This operation takes constant time.
Trait Implementations§
Source§impl<T: Endpoint, Item> FromIterator<Item> for RangeCase<T>where
Item: ClosedRange<EndT = T>,
impl<T: Endpoint, Item> FromIterator<Item> for RangeCase<T>where
Item: ClosedRange<EndT = T>,
Source§fn from_iter<It: IntoIterator<Item = Item>>(iter: It) -> Self
fn from_iter<It: IntoIterator<Item = Item>>(iter: It) -> Self
Creates a value from an iterator. Read more
Auto Trait Implementations§
impl<T> Freeze for RangeCase<T>where
T: Freeze,
impl<T> RefUnwindSafe for RangeCase<T>where
T: RefUnwindSafe,
impl<T> Send for RangeCase<T>where
T: Send,
impl<T> Sync for RangeCase<T>where
T: Sync,
impl<T> Unpin for RangeCase<T>where
T: Unpin,
impl<T> UnwindSafe for RangeCase<T>where
T: RefUnwindSafe + 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