Struct indexing::Range [] [src]

pub struct Range<'id, Proof = Unknown> { /* fields omitted */ }

A branded range.

Range<'id> only indexes the container instantiated with the exact same particular lifetime for the parameter 'id at its inception from the indices() constructor.

The Range may carry a proof of nonemptiness (type parameter Proof), which enables further methods.

Methods

impl<'id, P> Range<'id, P>
[src]

Return the length of the range.

Return true if the range is empty.

Try to create a proof that the Range is nonempty; return a Result where the Ok branch carries a non-empty Range.

Return the start index.

Return the end index.

Split the range in half, with the upper middle index landing in the latter half. Proof of length P transfers to the latter half.

Split to length index; if past the end, return false and clamp to the end

index is a relative index.

abs_index is an absolute index

Return an iterator that divides the range in n parts, in as even length chunks as possible.

Join together two adjacent ranges (they must be exactly touching, and in left to right order).

Extend the range to the end of other, including any space in between

Extend the range to start and end of other, including any space in between

Return two empty ranges, at the front and the back of the range respectively

Increment index, if doing so would still be before the end of the range

Return true if the index was incremented.

Increment r, clamping to the end of self.

impl<'id> Range<'id, NonEmpty>
[src]

Return the middle index, rounding down.

Produces mid where mid = start + (len - 1)/ 2.

Return the middle index, rounding up.

Produces mid where mid = start + len / 2.

Increase the range's start, if the result is still a non-empty range.

Return true if stepped successfully, false if the range would be empty.

Increase the range's start, if the result is still a non-empty range.

Return true if stepped successfully, false if the range would be empty.

Decrease the range's end, if the result is still a non-empty range.

Return true if stepped successfully, false if the range would be empty.

Trait Implementations

impl<'id, P> Copy for Range<'id, P>
[src]

impl<'id, P> Clone for Range<'id, P>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'id, P, Q> PartialEq<Range<'id, Q>> for Range<'id, P>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'id, P> Eq for Range<'id, P>
[src]

impl<'id, P> Debug for Range<'id, P>
[src]

Formats the value using the given formatter.

impl<'id> IntoCheckedRange<'id> for Range<'id>
[src]

impl<'id> IntoCheckedRange<'id> for Range<'id, NonEmpty>
[src]

impl<'id, P> IntoIterator for Range<'id, P>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more