[][src]Trait glsp::DequeAccess

pub trait DequeAccess<I>: DequeOps where
    I: DequeIndex
{ fn get<R>(&self, index: I) -> Result<R, GError>
    where
        R: FromElement<Self::Element>
;
fn set<V>(&self, index: I, val: V) -> Result<(), GError>
    where
        V: IntoElement<Self::Element>
;
fn insert<V>(&self, index: I, val: V) -> Result<(), GError>
    where
        V: IntoElement<Self::Element>
;
fn del(&self, index: I) -> Result<(), GError>;
fn remove<R>(&self, index: I) -> Result<R, GError>
    where
        R: FromElement<Self::Element>
;
fn swap_remove<R>(&self, index: I) -> Result<R, GError>
    where
        R: FromElement<Self::Element>
;
fn swap_remove_start<R>(&self, index: I) -> Result<R, GError>
    where
        R: FromElement<Self::Element>
; }

Indexing the deque abstract type.

When manipulating an Arr, Str or Deque, you'll mostly use this trait's methods, along with DequeOps and DequeAccessRange.

This trait is sealed. It's not possible to implement this trait for your own types.

Required methods

fn get<R>(&self, index: I) -> Result<R, GError> where
    R: FromElement<Self::Element>, 

Accesses an element in the deque.

Equivalent to [deq index].

fn set<V>(&self, index: I, val: V) -> Result<(), GError> where
    V: IntoElement<Self::Element>, 

Mutates an element in the deque.

Equivalent to (= [deq index] val).

fn insert<V>(&self, index: I, val: V) -> Result<(), GError> where
    V: IntoElement<Self::Element>, 

Inserts an element into the deque at the given index.

Equivalent to (insert! deq index val).

fn del(&self, index: I) -> Result<(), GError>

Deletes an element from the deque, without returning it.

Equivalent to (del! deq index).

fn remove<R>(&self, index: I) -> Result<R, GError> where
    R: FromElement<Self::Element>, 

Removes an element from the deque and returns it.

Equivalent to (remove! deq index).

fn swap_remove<R>(&self, index: I) -> Result<R, GError> where
    R: FromElement<Self::Element>, 

Swaps an element with the last element, removes it, and returns it.

Equivalent to (swap-remove! deq index).

fn swap_remove_start<R>(&self, index: I) -> Result<R, GError> where
    R: FromElement<Self::Element>, 

Swaps an element with the first element, removes it, and returns it.

Equivalent to (swap-remove-start! deq index).

Loading content...

Implementors

impl<I> DequeAccess<I> for Deque where
    I: DequeIndex
[src]

impl<I> DequeAccess<I> for Arr where
    I: DequeIndex
[src]

impl<I> DequeAccess<I> for Str where
    I: DequeIndex
[src]

Loading content...