Skip to main content

FingerTree

Struct FingerTree 

Source
pub struct FingerTree<T> { /* private fields */ }
Expand description

A finger tree sequence.

Implementations§

Source§

impl<T: Clone> FingerTree<T>

Source

pub fn new() -> Self

Create an empty finger tree.

Source

pub fn push_left(&mut self, value: T)

Push an element onto the left (front).

Source

pub fn push_right(&mut self, value: T)

Push an element onto the right (back).

Source

pub fn pop_left(&mut self) -> Option<T>

Pop an element from the left (front).

Source

pub fn pop_right(&mut self) -> Option<T>

Pop an element from the right (back).

Source

pub fn peek_left(&self) -> Option<&T>

Peek at the leftmost element.

Source

pub fn peek_right(&self) -> Option<&T>

Peek at the rightmost element.

Source

pub fn concat(&mut self, other: FingerTree<T>)

Concatenate another finger tree onto the right of this one.

Source

pub fn split_at(&mut self, at: usize) -> FingerTree<T>

Split the tree at index at, returning the right portion.

Source

pub fn len(&self) -> usize

Number of elements in the tree.

Source

pub fn is_empty(&self) -> bool

True if the tree is empty.

Source

pub fn to_vec(&self) -> Vec<T>

Collect all elements into a Vec.

Trait Implementations§

Source§

impl<T: Clone> Default for FingerTree<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for FingerTree<T>

§

impl<T> RefUnwindSafe for FingerTree<T>
where T: RefUnwindSafe,

§

impl<T> Send for FingerTree<T>
where T: Send,

§

impl<T> Sync for FingerTree<T>
where T: Sync,

§

impl<T> Unpin for FingerTree<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for FingerTree<T>

§

impl<T> UnwindSafe for FingerTree<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.