Struct strided::Stride [] [src]

#[repr(C)]
pub struct Stride<'a, T: 'a> { /* fields omitted */ }

A shared strided slice. This is equivalent to a &[T] that only refers to every nth T.

Methods

impl<'a, T> Stride<'a, T>
[src]

Creates a new strided slice directly from a conventional slice. The return value has stride 1.

Returns the number of elements accessible in self.

Returns the offset between successive elements of self as a count of elements, not bytes.

Returns a pointer to the first element of this strided slice.

NB. one must be careful since only every self.stride()th element is guaranteed to have unique access via this object; the others may be under the control of some other strided slice.

Breaks this strided slice into two strided slices pointing to alternate elements.

That is, it doubles the stride and (approximately) halves the length. A slice pointing to values [1, 2, 3, 4, 5] becomes two slices [1, 3, 5] and [2, 4]. This is guaranteed to succeed even if self.len() is odd, and even if self has only zero or one elements.

Returns an iterator over n strided subslices of self each pointing to every nth element, starting at successive offsets.

Calling substrides(3) on a slice pointing to [1, 2, 3, 4, 5, 6, 7] will yield, in turn, [1, 4, 7], [2, 5] and finally [3, 6]. Like with split2 this is guaranteed to succeed (return n strided slices) even if self has fewer than n elements and if self.len() is not a multiple of n.

Returns a reference to the nth element of self, or None if n is out-of-bounds.

Returns an iterator over references to each successive element of self.

Unlike MutStrides, this can return references with the maximum lifetime without consuming self and so an into_iter equivalent is unnecessary.

Returns a strided slice containing only the elements from indices from (inclusive) to to (exclusive).

Panic

Panics if from > to or if to > self.len().

Returns a strided slice containing only the elements from index from (inclusive).

Panic

Panics if from > self.len().

Returns a strided slice containing only the elements to index to (exclusive).

Panic

Panics if to > self.len().

Returns two strided slices, the first with elements up to idx (exclusive) and the second with elements from idx.

This is semantically equivalent to (self.slice_to(idx), self.slice_from(idx)).

Panic

Panics if idx > self.len().

Trait Implementations

impl<'a, T: PartialEq + 'a> PartialEq for Stride<'a, 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 + 'a> Eq for Stride<'a, T>
[src]

impl<'a, T: PartialOrd + 'a> PartialOrd for Stride<'a, 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 + 'a> Ord for Stride<'a, T>
[src]

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

impl<'a, T> Copy for Stride<'a, T>
[src]

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a, T: Sync> Sync for Stride<'a, T>
[src]

impl<'a, T: Sync> Send for Stride<'a, T>
[src]

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

Formats the value using the given formatter.

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

The returned type after indexing

The method for the indexing (container[index]) operation

impl<'a, T> Strided for Stride<'a, T>
[src]