[][src]Trait glsp::DequeOps

pub trait DequeOps: Sealed {
    type Element;
    type Item: FromElement<Self::Element>;
    pub fn push<V>(&self, val: V) -> Result<(), GError>
    where
        V: IntoElement<Self::Element>
;
pub fn pop<R>(&self) -> Result<R, GError>
    where
        R: FromElement<Self::Element>
;
pub fn push_start<V>(&self, val: V) -> Result<(), GError>
    where
        V: IntoElement<Self::Element>
;
pub fn pop_start<R>(&self) -> Result<R, GError>
    where
        R: FromElement<Self::Element>
;
pub fn grow<V>(
        &self,
        start_to_add: usize,
        end_to_add: usize,
        fill: V
    ) -> Result<(), GError>
    where
        V: IntoElement<Self::Element>
;
pub fn shrink(
        &self,
        start_to_remove: usize,
        end_to_remove: usize
    ) -> Result<(), GError>;
pub fn append(&self, other: &Self) -> Result<(), GError>;
pub fn prepend(&self, other: &Self) -> Result<(), GError>;
pub fn resize<V>(&self, new_len: usize, val: V) -> Result<(), GError>
    where
        V: IntoElement<Self::Element>
;
pub fn rotate_left(&self, mid: usize) -> Result<(), GError>;
pub fn rotate_right(&self, k: usize) -> Result<(), GError>;
pub fn swap<I1, I2>(&self, i: I1, j: I2) -> Result<(), GError>
    where
        I1: DequeIndex,
        I2: DequeIndex
;
pub fn capacity(&self) -> usize;
pub fn len(&self) -> usize;
pub fn reserve_exact(&self, additional: usize) -> Result<(), GError>;
pub fn reserve(&self, additional: usize) -> Result<(), GError>;
pub fn shrink_to_fit(&self) -> Result<(), GError>;
pub fn truncate(&self, len: usize) -> Result<(), GError>;
pub fn clear(&self) -> Result<(), GError>;
pub fn contains<V>(&self, x: V) -> Result<bool, GError>
    where
        V: IntoElement<Self::Element>
;
pub fn sort(&self) -> Result<(), GError>;
pub fn sort_by<F>(&self, f: F) -> Result<(), GError>
    where
        F: FnMut(&Self::Item, &Self::Item) -> Result<Ordering, GError>
;
pub fn freeze(&self);
pub fn deep_freeze(&self);
pub fn is_frozen(&self) -> bool;
pub fn is_deep_frozen(&self) -> bool;
pub fn can_mutate(&self) -> bool;
pub fn extend<I, V>(&self, source: I) -> Result<(), GError>
    where
        I: IntoIterator<Item = V>,
        V: IntoElement<Self::Element>
; pub fn is_empty(&self) -> bool { ... }
pub fn iter(&'a self) -> IterDeque<'a, Self>

Notable traits for IterDeque<'a, T>

impl<'a, T> Iterator for IterDeque<'a, T> where
    T: DequeAccess<usize>, 
type Item = <T as DequeOps>::Item;

    where
        Self: DequeAccess<usize>
, { ... }
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>
, { ... } }

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

Pushes the contents of an iterator onto the end of the deque.

Loading content...

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>

Notable traits for IterDeque<'a, T>

impl<'a, T> Iterator for IterDeque<'a, T> where
    T: DequeAccess<usize>, 
type Item = <T as DequeOps>::Item;
where
    Self: DequeAccess<usize>, 
[src]

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]

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.

Loading content...

Implementors

impl DequeOps for Deque[src]

type Element = Slot

type Item = Val

impl DequeOps for Arr[src]

type Element = Slot

type Item = Val

impl DequeOps for Str[src]

type Element = char

type Item = char

Loading content...