Struct CopyRange

Source
pub struct CopyRange<Idx> {
    pub start: Idx,
    pub end: Idx,
}
Expand description

A (half-open) range bounded inclusively below and exclusively above. See core::ops::Range.

Unlike Range, this struct is Copy if Idx is Copy, and implements IntoIterator instead of Interator.

Fields§

§start: Idx§end: Idx

Implementations§

Source§

impl<Idx> CopyRange<Idx>

Source

pub fn contains<U>(&self, item: &U) -> bool
where Idx: PartialOrd<U>, U: ?Sized + PartialOrd<Idx>,

Returns true if item is contained in the range.

See Range::contains.

Source

pub fn from_std(range: Range<Idx>) -> Self

Convert a Range into a CopyRange.

Source

pub fn into_std(self) -> Range<Idx>

Convert a CopyRange into a Range.

Source

pub fn is_empty(&self) -> bool
where Idx: PartialOrd,

Returns true if the range contains no items.

See Range::contains.

Source

pub fn len(&self) -> usize
where Range<Idx>: ExactSizeIterator, Self: Copy,

Returns the exact length of the range.

Trait Implementations§

Source§

impl<Idx: Clone> Clone for CopyRange<Idx>

Source§

fn clone(&self) -> CopyRange<Idx>

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

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

Performs copy-assignment from source. Read more
Source§

impl<Idx: Debug> Debug for CopyRange<Idx>

Source§

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

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

impl<Idx: Default> Default for CopyRange<Idx>

Source§

fn default() -> CopyRange<Idx>

Returns the “default value” for a type. Read more
Source§

impl<Idx> From<CopyRange<Idx>> for Range<Idx>

Convert a CopyRange into a Range.

Source§

fn from(value: CopyRange<Idx>) -> Self

Converts to this type from the input type.
Source§

impl<Idx> From<Range<Idx>> for CopyRange<Idx>

Convert a Range into a CopyRange.

Source§

fn from(_: Range<Idx>) -> Self

Converts to this type from the input type.
Source§

impl<Idx: Hash> Hash for CopyRange<Idx>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> Index<CopyRange<usize>> for [T]
where [T]: Index<Range<usize>>,

Source§

type Output = <[T] as Index<Range<usize>>>::Output

The returned type after indexing.
Source§

fn index(&self, index: CopyRange<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<CopyRange<usize>> for String

Source§

type Output = <String as Index<Range<usize>>>::Output

The returned type after indexing.
Source§

fn index(&self, index: CopyRange<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<CopyRange<usize>> for Vec<T>
where Vec<T>: Index<Range<usize>>,

Source§

type Output = <Vec<T> as Index<Range<usize>>>::Output

The returned type after indexing.
Source§

fn index(&self, index: CopyRange<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<CopyRange<usize>> for str
where str: Index<Range<usize>>,

Source§

type Output = <str as Index<Range<usize>>>::Output

The returned type after indexing.
Source§

fn index(&self, index: CopyRange<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<CopyRange<usize>> for [T]

Source§

fn index_mut(&mut self, index: CopyRange<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl IndexMut<CopyRange<usize>> for String

Source§

fn index_mut(&mut self, index: CopyRange<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<CopyRange<usize>> for Vec<T>
where Vec<T>: IndexMut<Range<usize>>,

Source§

fn index_mut(&mut self, index: CopyRange<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl IndexMut<CopyRange<usize>> for str

Source§

fn index_mut(&mut self, index: CopyRange<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<Idx> IntoIterator for CopyRange<Idx>
where Range<Idx>: Iterator<Item = Idx>,

Source§

type Item = Idx

The type of the elements being iterated over.
Source§

type IntoIter = Range<Idx>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<Idx: PartialEq> PartialEq for CopyRange<Idx>

Source§

fn eq(&self, other: &CopyRange<Idx>) -> bool

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

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<Idx> RangeBounds<Idx> for CopyRange<&Idx>

Source§

fn start_bound(&self) -> Bound<&Idx>

Start index bound. Read more
Source§

fn end_bound(&self) -> Bound<&Idx>

End index bound. Read more
1.35.0 · Source§

fn contains<U>(&self, item: &U) -> bool
where T: PartialOrd<U>, U: PartialOrd<T> + ?Sized,

Returns true if item is contained in the range. Read more
Source§

fn is_empty(&self) -> bool
where T: PartialOrd,

🔬This is a nightly-only experimental API. (range_bounds_is_empty)
Returns true if the range contains no items. One-sided ranges (RangeFrom, etc) always return false. Read more
Source§

impl<Idx> RangeBounds<Idx> for CopyRange<Idx>

Source§

fn start_bound(&self) -> Bound<&Idx>

Start index bound. Read more
Source§

fn end_bound(&self) -> Bound<&Idx>

End index bound. Read more
1.35.0 · Source§

fn contains<U>(&self, item: &U) -> bool
where T: PartialOrd<U>, U: PartialOrd<T> + ?Sized,

Returns true if item is contained in the range. Read more
Source§

fn is_empty(&self) -> bool
where T: PartialOrd,

🔬This is a nightly-only experimental API. (range_bounds_is_empty)
Returns true if the range contains no items. One-sided ranges (RangeFrom, etc) always return false. Read more
Source§

impl<Idx: Copy> Copy for CopyRange<Idx>

Source§

impl<Idx: Eq> Eq for CopyRange<Idx>

Source§

impl<Idx> StructuralPartialEq for CopyRange<Idx>

Auto Trait Implementations§

§

impl<Idx> Freeze for CopyRange<Idx>
where Idx: Freeze,

§

impl<Idx> RefUnwindSafe for CopyRange<Idx>
where Idx: RefUnwindSafe,

§

impl<Idx> Send for CopyRange<Idx>
where Idx: Send,

§

impl<Idx> Sync for CopyRange<Idx>
where Idx: Sync,

§

impl<Idx> Unpin for CopyRange<Idx>
where Idx: Unpin,

§

impl<Idx> UnwindSafe for CopyRange<Idx>
where Idx: 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.