Struct indexing::container::Container [] [src]

pub struct Container<'id, Array, Mode = ()> { /* fields omitted */ }

A branded container, that allows access only to indices and ranges with the exact same brand in the 'id parameter.

The elements in the underlying data structure are accessible partly through special purpose methods, and through indexing/slicing.

The Container can be indexed like self[i] where i is a trusted dereferenceable index or range, and equivalently using &self[i..] or &self[..i] where i is a trusted index. Indexing like this uses no runtime bounds checking at all, and it statically guaranteed to be in bounds.

The container can also be sliced for its complete range: &self[..].

Methods

impl<'id, Array, T, Mode> Container<'id, Array, Mode> where
    Array: Trustworthy<Item = T>, 
[src]

[src]

[src]

Convert the container into an only-indexing container.

The container no longer allows pointer access. This unlocks some features.

[src]

Return the range [0, 0)

[src]

Return the full range of the Container.

[src]

Vet the absolute index.

[src]

Vet the range r.

[src]

[src]

Split in two ranges, where the first includes the index and the second starts with the following index.

[src]

Split around the Range r: Return ranges corresponding to 0..r.start and r.end...

So that input r and return values (s, t) cover the whole container in the order s, r, t.

[src]

Return the range before (not including) the index itself

[src]

Return the range after (not including) the index itself

[src]

[src]

Increment index, if doing so would still be in bounds.

Return true if the index was incremented.

[src]

Increment index, if doing so would still be in bounds.

Return true if the index was incremented.

[src]

Increment r, clamping to the end of the Container.

[src]

Decrement index, if doing so would still be in bounds.

Return true if the index was decremented.

[src]

Examine the elements after index in order from lower indices towards higher. While the closure returns true, continue scan and include the scanned element in the range.

Result always includes index in the range

[src]

Examine the elements before index in order from higher indices towards lower. While the closure returns true, continue scan and include the scanned element in the range.

Result always includes index in the range.

[src]

Examine the elements range in order from lower indices towards higher. While the closure returns true, continue scan and include the scanned element in the range.

[src]

Swap elements at i and j (they may be equal).

[src]

Rotate elements in the range r by one step to the right (towards higher indices)

[src]

Rotate elements in the range r by one step to the left (towards lower indices)

[src]

Index by two nonoverlapping ranges, where r is before s.

[src]

Zip by raw pointer (will be indentical if ranges have same starting point)

impl<'id, Array, T> Container<'id, Array, OnlyIndex> where
    Array: Pushable<Item = T>, 
[src]

Methods specific to only index mode

[src]

Add one element to the underlying storage, and return its index.

All outstanding indices remain valid, only the length of the container is now larger.

[src]

Insert one element in the underlying storage at index.

All outstanding indices remain valid (in bounds), but elements have shifted.

impl<'id, T, Array> Container<'id, Array> where
    Array: Contiguous<Item = T>, 
[src]

[src]

[src]

[src]

[src]

[src]

Return the distance (in number of elements) from the start of the container to the pointer.

[src]

Examine the elements before index in order from higher indices towards lower. While the closure returns true, continue scan and include the scanned element in the range.

Result always includes index in the range

[src]

Examine the elements range in order from lower towards higher. While the closure returns true, continue scan and include the scanned element in the range.

[src]

[src]

Examine the elements range in order from higher towards lower While the closure returns true, continue scan and include the scanned element in the range.

impl<'id, T, Array> Container<'id, Array> where
    Array: Contiguous<Item = T>, 
[src]

[src]

impl<'id, T, Array> Container<'id, Array> where
    Array: ContiguousMut<Item = T>, 
[src]

[src]

Rotate elements in the range by one step to the right (towards higher indices)

[src]

Swap elements at i and j (they may be equal).

Trait Implementations

impl<'id, Array, Mode> Debug for Container<'id, Array, Mode> where
    Array: Debug
[src]

[src]

Formats the value using the given formatter.

impl<'id, Array, Mode> Clone for Container<'id, Array, Mode> where
    Array: Clone
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'id, Array, M> Index<Index<'id>> for Container<'id, Array, M> where
    Array: GetUnchecked
[src]

&self[i] where i is an Index<'id>.

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<'id, Array, M> IndexMut<Index<'id>> for Container<'id, Array, M> where
    Array: GetUncheckedMut
[src]

&mut self[i] where i is an Index<'id>.

[src]

Performs the mutable indexing (container[index]) operation.

impl<'id, T, Array, P, M> Index<Range<'id, P>> for Container<'id, Array, M> where
    Array: Contiguous<Item = T>, 
[src]

&self[r] where r is a Range<'id>.

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<'id, Array, P, M> IndexMut<Range<'id, P>> for Container<'id, Array, M> where
    Array: ContiguousMut
[src]

&mut self[r] where r is a Range<'id>.

[src]

Performs the mutable indexing (container[index]) operation.

impl<'id, T, P, Array, M> Index<RangeFrom<Index<'id, P>>> for Container<'id, Array, M> where
    Array: Contiguous<Item = T>, 
[src]

&self[i..] where i is an Index<'id, P> which may be an edge index.

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<'id, T, P, Array, M> IndexMut<RangeFrom<Index<'id, P>>> for Container<'id, Array, M> where
    Array: ContiguousMut<Item = T>, 
[src]

&mut self[i..] where i is an Index<'id, P> which may be an edge index.

[src]

Performs the mutable indexing (container[index]) operation.

impl<'id, T, P, Array, M> Index<RangeTo<Index<'id, P>>> for Container<'id, Array, M> where
    Array: Contiguous<Item = T>, 
[src]

&self[..i] where i is an Index<'id, P>, which may be an edge index.

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<'id, T, P, Array, M> IndexMut<RangeTo<Index<'id, P>>> for Container<'id, Array, M> where
    Array: ContiguousMut<Item = T>, 
[src]

&mut self[..i] where i is an Index<'id, P>, which may be an edge index.

[src]

Performs the mutable indexing (container[index]) operation.

impl<'id, T, Array, M> Index<RangeFull> for Container<'id, Array, M> where
    Array: Contiguous<Item = T>, 
[src]

&self[..]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<'id, T, Array> IndexMut<RangeFull> for Container<'id, Array> where
    Array: ContiguousMut<Item = T>, 
[src]

&mut self[..]

[src]

Performs the mutable indexing (container[index]) operation.

impl<'id, 'a, Array, T: 'a> ContainerRef<'id> for &'a Container<'id, Array> where
    Array: Contiguous<Item = T>, 
[src]

[src]

impl<'id, 'a, Array, T: 'a> ContainerRef<'id> for &'a mut Container<'id, Array> where
    Array: ContiguousMut<Item = T>, 
[src]

[src]

impl<'id, T, Array, P> Index<PRange<'id, T, P>> for Container<'id, Array> where
    Array: Contiguous<Item = T>, 
[src]

&self[r] where r is a PRange<'id>.

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<'id, T, Array, P> IndexMut<PRange<'id, T, P>> for Container<'id, Array> where
    Array: ContiguousMut<Item = T>, 
[src]

&mut self[r] where r is a Range<'id>.

[src]

Performs the mutable indexing (container[index]) operation.

impl<'id, 'a, T, Array> Index<PIndex<'id, T>> for Container<'id, Array> where
    Array: Contiguous<Item = T>, 
[src]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<'id, T, P, Array> Index<RangeTo<PIndex<'id, T, P>>> for Container<'id, Array> where
    Array: Contiguous<Item = T>, 
[src]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<'id, T, P, Array> IndexMut<RangeTo<PIndex<'id, T, P>>> for Container<'id, Array> where
    Array: ContiguousMut<Item = T>, 
[src]

[src]

Performs the mutable indexing (container[index]) operation.

impl<'id, T, P, Array> Index<RangeFrom<PIndex<'id, T, P>>> for Container<'id, Array> where
    Array: Contiguous<Item = T>, 
[src]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<'id, T, P, Array> IndexMut<RangeFrom<PIndex<'id, T, P>>> for Container<'id, Array> where
    Array: ContiguousMut<Item = T>, 
[src]

[src]

Performs the mutable indexing (container[index]) operation.