Struct gapbuf::Range[][src]

pub struct Range<'a, T: 'a> { /* fields omitted */ }

Immutable sub-range of GapBuffer

Methods

impl<'a, T: 'a> Range<'a, T>
[src]

Construct a new, empty Range.

Methods from Deref<Target = Slice<T>>

Returns the number of elements in the GapBuffer.

Returns true if the GapBuffer contains no elements.

Returns a reference to an element at index or None if out of bounds.

Return a immutable sub-range of this Slice.

Panics

Panics if range is out of bounds.

Examples

let buf = gap_buffer![1, 2, 3, 4, 5];

let r1 = buf.range(1..);
assert_eq!(r1, [2, 3, 4, 5]);

let r2 = r1.range(1..3);
assert_eq!(r2, [3, 4]);

Returns a pair of slices. First slice is before gap. Second slice is after gap.

Examples

let mut buf = gap_buffer![1, 2, 3, 4, 5];
buf.set_gap(2);
let (s1, s2) = buf.as_slices();
assert_eq!(s1, [1, 2]);
assert_eq!(s2, [3, 4, 5]);

Returns an iterator over the Slice.

Trait Implementations

impl<'a, T: Hash + 'a> Hash for Range<'a, T>
[src]

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

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

impl<'a, T> Deref for Range<'a, T>
[src]

The resulting type after dereferencing.

Dereferences the value.

impl<'a, T> Clone for Range<'a, T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a, T> Default for Range<'a, T>
[src]

Returns the "default value" for a type. Read more

impl<'a, T> Index<usize> for Range<'a, T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<'a, T> Debug for Range<'a, T> where
    T: Debug
[src]

Formats the value using the given formatter. Read more

impl<'a, T, S> PartialEq<S> for Range<'a, T> where
    T: PartialEq,
    S: ?Sized,
    &'b S: IntoIterator<Item = &'b T>, 
[src]

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

This method tests for !=.

impl<'a, T: Eq> Eq for Range<'a, T>
[src]

impl<'a, T, S> PartialOrd<S> for Range<'a, T> where
    T: PartialOrd,
    S: ?Sized,
    &'b S: IntoIterator<Item = &'b T>, 
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<'a, T: Ord> Ord for Range<'a, T>
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl<'a, 'b, T> IntoIterator for &'a Range<'b, T>
[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

Auto Trait Implementations

impl<'a, T> Send for Range<'a, T> where
    T: Send + Sync

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