[−][src]Struct index_ext::tag::Idx
A valid index for all slices of the same length.
While this has a generic parameter, you can only instantiate this type for specific types
through one of the constructors of a corresponding [Len]
struct.
Implementations
impl<T, I> Idx<I, T>
[src]
pub fn into_inner(self) -> I
[src]
Get the inner index.
impl<T> Idx<usize, T>
[src]
#[must_use = "Returns a new index"]pub fn saturating_sub(self, sub: usize) -> Self
[src]
Create a smaller index.
#[must_use = "Returns a new index"]pub fn truncate(self, min: usize) -> Self
[src]
Bound the index from above.
#[must_use = "Returns a new index"]pub fn into_range(self) -> Idx<Range<usize>, T>
[src]
Return the range that contains this element.
#[must_use = "Returns a new index"]pub fn into_len(self) -> Len<T>
[src]
Get a length up-to, not including this index.
#[must_use = "Returns a new index"]pub fn into_end(self) -> NonZeroLen<T>
[src]
Get the length beyond this index.
Unlike turning it into a range and using its end, this guarantees that the end is non-zero as it knows the range not to be empty.
impl<T> Idx<RangeTo<usize>, T>
[src]
#[must_use = "Returns a new index"]pub fn into_end(self) -> Len<T>
[src]
Get a length up-to, not including this index.
#[must_use = "Returns a new index"]pub fn range_from(self, from: Len<T>) -> Option<Idx<Range<usize>, T>>
[src]
Construct an index starting at an element.
This method return Some
when from
does not exceed the end index.
impl<T> Idx<RangeFrom<usize>, T>
[src]
#[must_use = "Returns a new index"]pub fn into_start(self) -> Len<T>
[src]
Get a length up-to, not including this index.
#[must_use = "Returns a new index"]pub fn range_to(self, to: Len<T>) -> Option<Idx<Range<usize>, T>>
[src]
Construct an index up to at an element.
This method return Some
when to
does not exceed the end index.
impl<T> Idx<Range<usize>, T>
[src]
#[must_use = "Returns a new index"]pub fn into_start(self) -> Len<T>
[src]
Get a length up-to, not including this index.
#[must_use = "Returns a new index"]pub fn into_end(self) -> Len<T>
[src]
Get a length up-to, not including this index.
Trait Implementations
impl<I: Clone, Tag: Clone> Clone for Idx<I, Tag>
[src]
fn clone(&self) -> Idx<I, Tag>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<I: Copy, Tag: Copy> Copy for Idx<I, Tag>
[src]
impl<T: Tag, E, I, '_> Index<Idx<I, T>> for Ref<'_, E, T> where
I: SliceIndex<[E]>,
[src]
I: SliceIndex<[E]>,
type Output = I::Output
The returned type after indexing.
fn index(&self, idx: Idx<I, T>) -> &Self::Output
[src]
impl<T: Tag, E, I, '_> Index<Idx<I, T>> for Mut<'_, E, T> where
I: SliceIndex<[E]>,
[src]
I: SliceIndex<[E]>,
type Output = I::Output
The returned type after indexing.
fn index(&self, idx: Idx<I, T>) -> &Self::Output
[src]
impl<T: Tag, E, I, '_> IndexMut<Idx<I, T>> for Mut<'_, E, T> where
I: SliceIndex<[E]>,
[src]
I: SliceIndex<[E]>,
Auto Trait Implementations
impl<I, Tag> Send for Idx<I, Tag> where
I: Send,
Tag: Send,
I: Send,
Tag: Send,
impl<I, Tag> Sync for Idx<I, Tag> where
I: Sync,
Tag: Sync,
I: Sync,
Tag: Sync,
impl<I, Tag> Unpin for Idx<I, Tag> where
I: Unpin,
Tag: Unpin,
I: Unpin,
Tag: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,