[−][src]Trait glsp::DequeOps
The deque
abstract type.
When manipulating an Arr
, Str
or
Deque
, you'll mostly use this trait's methods.
This trait defines all of a deque's operations other than indexing. For indexing a deque,
use the traits DequeAccess
and
DequeAccessRange
.
This trait is sealed. It's not possible to implement this trait for your own types.
Associated Types
Loading content...Required methods
pub fn push<V>(&self, val: V) -> Result<(), GError> where
V: IntoElement<Self::Element>,
[src]
V: IntoElement<Self::Element>,
Pushes an element to the end of the deque.
Equivalent to (push! deq val)
.
pub fn pop<R>(&self) -> Result<R, GError> where
R: FromElement<Self::Element>,
[src]
R: FromElement<Self::Element>,
Pops an element from the end of the deque.
Equivalent to (pop! deq)
.
pub fn push_start<V>(&self, val: V) -> Result<(), GError> where
V: IntoElement<Self::Element>,
[src]
V: IntoElement<Self::Element>,
Pushes an element to the beginning of the deque.
Equivalent to (push-start! deq val)
.
pub fn pop_start<R>(&self) -> Result<R, GError> where
R: FromElement<Self::Element>,
[src]
R: FromElement<Self::Element>,
Pops an element from the beginning of the deque.
Equivalent to (pop-start! deq)
.
pub fn grow<V>(
&self,
start_to_add: usize,
end_to_add: usize,
fill: V
) -> Result<(), GError> where
V: IntoElement<Self::Element>,
[src]
&self,
start_to_add: usize,
end_to_add: usize,
fill: V
) -> Result<(), GError> where
V: IntoElement<Self::Element>,
Increases the deque's size.
Equivalent to (grow! deq start-n end-n fill)
.
pub fn shrink(
&self,
start_to_remove: usize,
end_to_remove: usize
) -> Result<(), GError>
[src]
&self,
start_to_remove: usize,
end_to_remove: usize
) -> Result<(), GError>
Decreases the deque's size.
Equivalent to (shrink! deq start-n end-n
.
pub fn append(&self, other: &Self) -> Result<(), GError>
[src]
Pushes the contents of another deque onto the end of this one.
pub fn prepend(&self, other: &Self) -> Result<(), GError>
[src]
Pushes the contents of another deque onto the beginning of this one.
pub fn resize<V>(&self, new_len: usize, val: V) -> Result<(), GError> where
V: IntoElement<Self::Element>,
[src]
V: IntoElement<Self::Element>,
Resizes the deque.
Equivalent to VecDeque::resize
.
pub fn rotate_left(&self, mid: usize) -> Result<(), GError>
[src]
Rotates the deque to the left
Equivalent to VecDeque::rotate_left
.
pub fn rotate_right(&self, k: usize) -> Result<(), GError>
[src]
Rotates the deque to the right.
Equivalent to VecDeque::rotate_right
.
pub fn swap<I1, I2>(&self, i: I1, j: I2) -> Result<(), GError> where
I1: DequeIndex,
I2: DequeIndex,
[src]
I1: DequeIndex,
I2: DequeIndex,
Swaps two of the deque's elements.
Equivalent to (swap! [deq i] [deq j])
.
pub fn capacity(&self) -> usize
[src]
Returns the deque's storage capacity.
Equivalent to VecDeque::capacity
.
pub fn len(&self) -> usize
[src]
Returns the deque's length.
Equivalent to (len deq)
.
pub fn reserve_exact(&self, additional: usize) -> Result<(), GError>
[src]
Reserves enough space for exactly additional
elements to be added to the deque.
Equivalent to VecDeque::reserve_exact
.
pub fn reserve(&self, additional: usize) -> Result<(), GError>
[src]
Reserves enough space for at least additional
elements to be added to the deque.
Equivalent to VecDeque::reserve
.
pub fn shrink_to_fit(&self) -> Result<(), GError>
[src]
Shrinks the capacity of the deque as much as possible.
Equivalent to VecDeque::shrink_to_fit
.
pub fn truncate(&self, len: usize) -> Result<(), GError>
[src]
Reduces the deque's length.
Equivalent to VecDeque::truncate
.
pub fn clear(&self) -> Result<(), GError>
[src]
Removes all of the deque's elements.
Equivalent to VecDeque::clear
.
pub fn contains<V>(&self, x: V) -> Result<bool, GError> where
V: IntoElement<Self::Element>,
[src]
V: IntoElement<Self::Element>,
Tests whether the deque contains an element which compares eq?
to the argument.
Equivalent to VecDeque::contains
.
pub fn sort(&self) -> Result<(), GError>
[src]
Sorts the deque, in place. Elements are compared using Val::partial_cmp
.
If the deque contains any two elements which are unordered relative to one another
(for example, an integer and a symbol), an error may occur.
pub fn sort_by<F>(&self, f: F) -> Result<(), GError> where
F: FnMut(&Self::Item, &Self::Item) -> Result<Ordering, GError>,
[src]
F: FnMut(&Self::Item, &Self::Item) -> Result<Ordering, GError>,
Sorts the deque, in place, using the specified comparison function. If the comparison
function returns an error, the sort_by
call will return an error.
pub fn freeze(&self)
[src]
Makes the deque immutable.
Equivalent to (freeze! deq)
.
pub fn deep_freeze(&self)
[src]
Makes the deque and all of its contents immutable.
Equivalent to (deep-freeze! deq)
.
pub fn is_frozen(&self) -> bool
[src]
Returns true
if the deque has been frozen.
pub fn is_deep_frozen(&self) -> bool
[src]
Returns true
if the deque and all of its contents have been frozen.
pub fn can_mutate(&self) -> bool
[src]
Returns true
if it's possible to mutate the deque without triggering an error.
This method will currently return false
if the deque has been frozen, or if it's
currently being iterated from Rust.
pub fn extend<I, V>(&self, source: I) -> Result<(), GError> where
I: IntoIterator<Item = V>,
V: IntoElement<Self::Element>,
[src]
I: IntoIterator<Item = V>,
V: IntoElement<Self::Element>,
Pushes the contents of an iterator onto the end of the deque.
Provided methods
pub fn is_empty(&self) -> bool
[src]
Returns true
if the deque's length is 0.
Equivalent to (empty? deq)
.
pub fn iter(&'a self) -> IterDeque<'a, Self>ⓘ where
Self: DequeAccess<usize>,
[src]
Self: DequeAccess<usize>,
Creates an infallible iterator over this deque.
The iterator's item type will be Val
for Arr
and
Deque
, or char
for Str
.
pub fn iter_to<R>(&'a self) -> IterDequeTo<'a, Self, R>ⓘNotable traits for IterDequeTo<'a, T, R>
impl<'a, T, R> Iterator for IterDequeTo<'a, T, R> where
T: DequeAccess<usize>,
R: FromElement<<T as DequeOps>::Element>, type Item = Result<R, GError>;
where
Self: DequeAccess<usize>,
R: FromElement<Self::Element>,
[src]
Notable traits for IterDequeTo<'a, T, R>
impl<'a, T, R> Iterator for IterDequeTo<'a, T, R> where
T: DequeAccess<usize>,
R: FromElement<<T as DequeOps>::Element>, type Item = Result<R, GError>;
Self: DequeAccess<usize>,
R: FromElement<Self::Element>,
Creates a converting iterator over this deque.
The iterator can produce any type which implements FromElement
,
but each item will be wrapped in a GResult<T>
, so it will need
to be unwrapped using ?
before it can be used.
Implementors
impl DequeOps for Deque
[src]
type Element = Slot
type Item = Val
pub fn freeze(&self)
[src]
pub fn deep_freeze(&self)
[src]
pub fn is_frozen(&self) -> bool
[src]
pub fn is_deep_frozen(&self) -> bool
[src]
pub fn sort(&self) -> Result<(), GError>
[src]
pub fn sort_by<F>(&self, f: F) -> Result<(), GError> where
F: FnMut(&Val, &Val) -> Result<Ordering, GError>,
[src]
F: FnMut(&Val, &Val) -> Result<Ordering, GError>,
pub fn can_mutate(&self) -> bool
[src]
pub fn swap<I1, I2>(&self, i: I1, j: I2) -> Result<(), GError> where
I1: DequeIndex,
I2: DequeIndex,
[src]
I1: DequeIndex,
I2: DequeIndex,
pub fn len(&self) -> usize
[src]
pub fn contains<V>(&self, v: V) -> Result<bool, GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn push<V>(&self, v: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn pop<R>(&self) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
pub fn push_start<V>(&self, v: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn pop_start<R>(&self) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
pub fn grow<V>(&self, start: usize, end: usize, fill: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn shrink(&self, start: usize, end: usize) -> Result<(), GError>
[src]
pub fn append(&self, _other: &Deque) -> Result<(), GError>
[src]
pub fn prepend(&self, _other: &Deque) -> Result<(), GError>
[src]
pub fn resize<V>(&self, new_len: usize, fill: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn rotate_left(&self, mid: usize) -> Result<(), GError>
[src]
pub fn rotate_right(&self, k: usize) -> Result<(), GError>
[src]
pub fn capacity(&self) -> usize
[src]
pub fn reserve_exact(&self, additional: usize) -> Result<(), GError>
[src]
pub fn reserve(&self, additional: usize) -> Result<(), GError>
[src]
pub fn shrink_to_fit(&self) -> Result<(), GError>
[src]
pub fn truncate(&self, len: usize) -> Result<(), GError>
[src]
pub fn clear(&self) -> Result<(), GError>
[src]
pub fn extend<I, C>(&self, source: I) -> Result<(), GError> where
C: IntoElement<Slot>,
I: IntoIterator<Item = C>,
[src]
C: IntoElement<Slot>,
I: IntoIterator<Item = C>,
impl DequeOps for Arr
[src]
type Element = Slot
type Item = Val
pub fn freeze(&self)
[src]
pub fn deep_freeze(&self)
[src]
pub fn is_frozen(&self) -> bool
[src]
pub fn is_deep_frozen(&self) -> bool
[src]
pub fn can_mutate(&self) -> bool
[src]
pub fn sort(&self) -> Result<(), GError>
[src]
pub fn sort_by<F>(&self, f: F) -> Result<(), GError> where
F: FnMut(&Val, &Val) -> Result<Ordering, GError>,
[src]
F: FnMut(&Val, &Val) -> Result<Ordering, GError>,
pub fn push<V>(&self, val: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn pop<R>(&self) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
pub fn push_start<V>(&self, val: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn pop_start<R>(&self) -> Result<R, GError> where
R: FromElement<Slot>,
[src]
R: FromElement<Slot>,
pub fn grow<V>(
&self,
start_to_add: usize,
end_to_add: usize,
fill: V
) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
&self,
start_to_add: usize,
end_to_add: usize,
fill: V
) -> Result<(), GError> where
V: IntoElement<Slot>,
pub fn shrink(
&self,
start_to_remove: usize,
end_to_remove: usize
) -> Result<(), GError>
[src]
&self,
start_to_remove: usize,
end_to_remove: usize
) -> Result<(), GError>
pub fn append(&self, other: &Arr) -> Result<(), GError>
[src]
pub fn prepend(&self, other: &Arr) -> Result<(), GError>
[src]
pub fn resize<V>(&self, new_len: usize, fill: V) -> Result<(), GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn rotate_left(&self, mid: usize) -> Result<(), GError>
[src]
pub fn rotate_right(&self, k: usize) -> Result<(), GError>
[src]
pub fn swap<I1, I2>(&self, index1: I1, index2: I2) -> Result<(), GError> where
I1: DequeIndex,
I2: DequeIndex,
[src]
I1: DequeIndex,
I2: DequeIndex,
pub fn capacity(&self) -> usize
[src]
pub fn len(&self) -> usize
[src]
pub fn reserve_exact(&self, additional: usize) -> Result<(), GError>
[src]
pub fn reserve(&self, additional: usize) -> Result<(), GError>
[src]
pub fn shrink_to_fit(&self) -> Result<(), GError>
[src]
pub fn truncate(&self, len: usize) -> Result<(), GError>
[src]
pub fn clear(&self) -> Result<(), GError>
[src]
pub fn contains<V>(&self, x: V) -> Result<bool, GError> where
V: IntoElement<Slot>,
[src]
V: IntoElement<Slot>,
pub fn extend<I, V>(&self, source: I) -> Result<(), GError> where
I: IntoIterator<Item = V>,
V: IntoElement<Slot>,
[src]
I: IntoIterator<Item = V>,
V: IntoElement<Slot>,
impl DequeOps for Str
[src]
type Element = char
type Item = char
pub fn freeze(&self)
[src]
pub fn deep_freeze(&self)
[src]
pub fn is_frozen(&self) -> bool
[src]
pub fn is_deep_frozen(&self) -> bool
[src]
pub fn can_mutate(&self) -> bool
[src]
pub fn sort(&self) -> Result<(), GError>
[src]
pub fn sort_by<F>(&self, f: F) -> Result<(), GError> where
F: FnMut(&char, &char) -> Result<Ordering, GError>,
[src]
F: FnMut(&char, &char) -> Result<Ordering, GError>,
pub fn push<C>(&self, ch: C) -> Result<(), GError> where
C: IntoElement<char>,
[src]
C: IntoElement<char>,
pub fn pop<R>(&self) -> Result<R, GError> where
R: FromElement<char>,
[src]
R: FromElement<char>,
pub fn push_start<C>(&self, ch: C) -> Result<(), GError> where
C: IntoElement<char>,
[src]
C: IntoElement<char>,
pub fn pop_start<R>(&self) -> Result<R, GError> where
R: FromElement<char>,
[src]
R: FromElement<char>,
pub fn grow<C>(
&self,
start_to_add: usize,
end_to_add: usize,
fill: C
) -> Result<(), GError> where
C: IntoElement<char>,
[src]
&self,
start_to_add: usize,
end_to_add: usize,
fill: C
) -> Result<(), GError> where
C: IntoElement<char>,
pub fn shrink(
&self,
start_to_remove: usize,
end_to_remove: usize
) -> Result<(), GError>
[src]
&self,
start_to_remove: usize,
end_to_remove: usize
) -> Result<(), GError>
pub fn append(&self, other: &Str) -> Result<(), GError>
[src]
pub fn prepend(&self, other: &Str) -> Result<(), GError>
[src]
pub fn resize<C>(&self, new_len: usize, ch: C) -> Result<(), GError> where
C: IntoElement<char>,
[src]
C: IntoElement<char>,
pub fn rotate_left(&self, mid: usize) -> Result<(), GError>
[src]
pub fn rotate_right(&self, k: usize) -> Result<(), GError>
[src]
pub fn swap<I1, I2>(&self, i_index: I1, j_index: I2) -> Result<(), GError> where
I1: DequeIndex,
I2: DequeIndex,
[src]
I1: DequeIndex,
I2: DequeIndex,
pub fn capacity(&self) -> usize
[src]
pub fn len(&self) -> usize
[src]
pub fn reserve_exact(&self, additional: usize) -> Result<(), GError>
[src]
pub fn reserve(&self, additional: usize) -> Result<(), GError>
[src]
pub fn shrink_to_fit(&self) -> Result<(), GError>
[src]
pub fn truncate(&self, len: usize) -> Result<(), GError>
[src]
pub fn clear(&self) -> Result<(), GError>
[src]
pub fn contains<C>(&self, ch: C) -> Result<bool, GError> where
C: IntoElement<char>,
[src]
C: IntoElement<char>,
pub fn extend<I, C>(&self, source: I) -> Result<(), GError> where
C: IntoElement<char>,
I: IntoIterator<Item = C>,
[src]
C: IntoElement<char>,
I: IntoIterator<Item = C>,