pub struct Range<N: Rangeable> { /* private fields */ }Expand description
An inclusive integer range with the ability to have an infinite value on both sides
Implementations§
Source§impl<N: Rangeable> Range<N>
impl<N: Rangeable> Range<N>
Sourcepub fn canonicalize(self) -> Self
pub fn canonicalize(self) -> Self
Canonicalize this range so that the smaller number is on the left
Sourcepub fn make_single_infinite(self) -> Self
pub fn make_single_infinite(self) -> Self
Prepare this range for codegen by changing a double infinite into a single infinite
Sourcepub fn get_single(&self) -> Option<N>
pub fn get_single(&self) -> Option<N>
Tries to get a single number from this range if it is exactly one long
Sourcepub fn is_infinite(&self) -> bool
pub fn is_infinite(&self) -> bool
Checks if this range is fully infinite
Trait Implementations§
Source§impl<N: Rangeable> Codegen for Range<N>
impl<N: Rangeable> Codegen for Range<N>
fn gen_writer<F>(
&self,
f: &mut F,
cbcx: &mut CodegenBlockCx<'_, '_>,
) -> Result<()>where
F: Write,
fn gen_str(&self, cbcx: &mut CodegenBlockCx<'_, '_>) -> Result<String>
impl<N: Eq + Rangeable> Eq for Range<N>
impl<N: Rangeable> StructuralPartialEq for Range<N>
Auto Trait Implementations§
impl<N> Freeze for Range<N>where
N: Freeze,
impl<N> RefUnwindSafe for Range<N>where
N: RefUnwindSafe,
impl<N> Send for Range<N>where
N: Send,
impl<N> Sync for Range<N>where
N: Sync,
impl<N> Unpin for Range<N>where
N: Unpin,
impl<N> UnwindSafe for Range<N>where
N: 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
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