Struct Range

Source
pub struct Range<T: Ord> { /* private fields */ }
Expand description

A range between point A and B, start and end are both std Bound objects

Implementations§

Source§

impl<T: Ord> Range<T>

Source

pub fn new(from: Bound<T>, to: Bound<T>) -> Range<T>

Create a new range from the 2 given bounds

Source

pub fn unbound() -> Range<T>

Create a new infinite range

Source

pub fn start(&self) -> Bound<&T>

Return the starting boundary of the range, with the child object as reference

Source

pub fn start_pos(&self) -> PositionalBound<&T>

Return the starting boundary or the range but as PositionalBound

Source

pub fn end(&self) -> Bound<&T>

Return the ending boundary of the range, with the child object as reference

Source

pub fn end_pos(&self) -> PositionalBound<&T>

Return the ending boundary or the range but as PositionalBound

Source

pub fn is_unbound(&self) -> bool

Returns true if this boundary is unbounded, or infinite

Source

pub fn contains(&self, item: &T) -> bool

Returns true if given item falls within this range

Source

pub fn into_inner(self) -> (Bound<T>, Bound<T>)

Returns the internal start and end boundaries

Source§

impl<T: Ord + Clone> Range<T>

Source

pub fn from_range<R: RangeBounds<T>>(value: R) -> Self

Create a new Range from the

Trait Implementations§

Source§

impl<T: Clone + Ord> Clone for Range<T>

Source§

fn clone(&self) -> Range<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Ord> Debug for Range<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Ord + Debug> From<(Bound<T>, Bound<T>)> for Range<T>

Source§

fn from(value: (Bound<T>, Bound<T>)) -> Self

Converts to this type from the input type.
Source§

impl<T: Ord> From<(T, T)> for Range<T>

Source§

fn from(value: (T, T)) -> Self

Converts to this type from the input type.
Source§

impl<T: Ord + Debug> From<Range<T>> for Range<T>

Source§

fn from(value: Range<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Ord + Debug> From<RangeFrom<T>> for Range<T>

Source§

fn from(value: RangeFrom<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Ord + Debug> From<RangeFull> for Range<T>

Source§

fn from(_: RangeFull) -> Self

Converts to this type from the input type.
Source§

impl<T: Ord + Debug> From<RangeInclusive<T>> for Range<T>

Source§

fn from(range: RangeInclusive<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Ord + Debug> From<RangeTo<T>> for Range<T>

Source§

fn from(range: RangeTo<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Ord + Debug> From<RangeToInclusive<T>> for Range<T>

Source§

fn from(range: RangeToInclusive<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: PartialEq + Ord> PartialEq for Range<T>

Source§

fn eq(&self, other: &Range<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq + Ord> Eq for Range<T>

Source§

impl<T: Ord> StructuralPartialEq for Range<T>

Auto Trait Implementations§

§

impl<T> Freeze for Range<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Range<T>
where T: RefUnwindSafe,

§

impl<T> Send for Range<T>
where T: Send,

§

impl<T> Sync for Range<T>
where T: Sync,

§

impl<T> Unpin for Range<T>
where T: Unpin,

§

impl<T> UnwindSafe for Range<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.