[−][src]Trait glsp::DequeAccess
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]
R: FromElement<Self::Element>,
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]
V: IntoElement<Self::Element>,
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]
V: IntoElement<Self::Element>,
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]
R: FromElement<Self::Element>,
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]
R: FromElement<Self::Element>,
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]
R: FromElement<Self::Element>,
Swaps an element with the first element, removes it, and returns it.
Equivalent to (swap-remove-start! deq index)
.
Implementors
impl<I> DequeAccess<I> for Deque where
I: DequeIndex,
[src]
I: DequeIndex,
pub fn get<R>(&self, i: I) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
pub fn set<V>(&self, i: I, v: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn insert<V>(&self, i: I, v: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn del(&self, i: I) -> Result<(), GError>
[src]
pub fn remove<R>(&self, i: I) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
pub fn swap_remove<R>(&self, i: I) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
pub fn swap_remove_start<R>(&self, i: I) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
impl<I> DequeAccess<I> for Arr where
I: DequeIndex,
[src]
I: DequeIndex,
pub fn get<R>(&self, index: I) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
pub fn set<V>(&self, index: I, val: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn insert<V>(&self, index: I, val: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn del(&self, index: I) -> Result<(), GError>
[src]
pub fn remove<R>(&self, index: I) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
pub fn swap_remove<R>(&self, index: I) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
pub fn swap_remove_start<R>(&self, index: I) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
impl<I> DequeAccess<I> for Str where
I: DequeIndex,
[src]
I: DequeIndex,
pub fn get<R>(&self, index: I) -> Result<R, GError> where
R: FromElement<char>,
[src]
R: FromElement<char>,
pub fn set<C>(&self, index: I, ch: C) -> Result<(), GError> where
C: IntoElement<char>,
[src]
C: IntoElement<char>,
pub fn insert<C>(&self, index: I, ch: C) -> Result<(), GError> where
C: IntoElement<char>,
[src]
C: IntoElement<char>,
pub fn del(&self, index: I) -> Result<(), GError>
[src]
pub fn remove<R>(&self, index: I) -> Result<R, GError> where
R: FromElement<char>,
[src]
R: FromElement<char>,
pub fn swap_remove<R>(&self, index: I) -> Result<R, GError> where
R: FromElement<char>,
[src]
R: FromElement<char>,
pub fn swap_remove_start<R>(&self, index: I) -> Result<R, GError> where
R: FromElement<char>,
[src]
R: FromElement<char>,