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.

The range is delimited by a start index and an end index. Some methods will use offsets relative the the start of a range, others will use “absolute indices” which are offsets relative to the base Container itself.

Methods

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

[src]

Return the length of the range.

[src]

Return true if the range is empty.

[src]

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

[src]

Return the start index.

[src]

Return the end index.

[src]

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

[src]

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

index is a relative index.

[src]

abs_index is an absolute index

[src]

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

[src]

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

[src]

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

[src]

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

[src]

[src]

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

[src]

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

Return true if the index was incremented.

[src]

Increment r, clamping to the end of self.

[src]

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

[src]

Return the first index in the range (The index is accessible if the range is NonEmpty).

[src]

Return the middle index, rounding up.

Produces mid where mid = start + len / 2.

[src]

Return the index past the end of the range.

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

[src]

Return the middle index, rounding down.

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

[src]

[src]

[src]

[src]

[src]

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.

[src]

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.

[src]

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, Q> PartialEq<Range<'id, Q>> for Range<'id, P>
[src]

[src]

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

1.0.0
[src]

This method tests for !=.

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

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

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

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

[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?

[src]

Creates an iterator from a value. Read more

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

[src]

Return a copy of self with the proof parameter set to Unknown.

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

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more