[][src]Trait glsp::DequeAccess

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

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

Accesses an element in the deque.

Equivalent to [deq index].

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

Mutates an element in the deque.

Equivalent to (= [deq index] val).

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

Inserts an element into the deque at the given index.

Equivalent to (insert! deq index val).

pub fn del(&self, index: I) -> Result<(), GError>[src]

Deletes an element from the deque, without returning it.

Equivalent to (del! deq index).

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

Removes an element from the deque and returns it.

Equivalent to (remove! deq index).

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

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

Equivalent to (swap-remove! deq index).

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

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...