[][src]Struct toolshed::list::List

pub struct List<'arena, T> { /* fields omitted */ }

A single-ended linked list.

Methods

impl<'arena, T> List<'arena, T>[src]

pub const fn empty() -> Self[src]

Create a new empty List.

pub fn clear(&self)[src]

Turns the list into an empty list.

Internally, all this method does is removing the reference to the first item on the list.

Important traits for ListIter<'arena, T>
pub fn iter(&self) -> ListIter<'arena, T>[src]

Returns an iterator over the items in the list.

pub fn is_empty(&self) -> bool[src]

Checks if the list is empty.

pub fn only_element(&self) -> Option<&'arena T>[src]

Returns the first element if, and only if, the list contains just that single element.

pub fn first_element(&self) -> Option<&'arena T>[src]

Returns the reference to the first element.

pub fn into_unsafe(self) -> UnsafeList[src]

Returns an UnsafeList for the current List. While this function is safe itself, using UnsafeList might lead to undefined behavior.

impl<'arena, T: Copy> List<'arena, T>[src]

pub fn from(arena: &'arena Arena, value: T) -> List<'arena, T>[src]

Create a single-element list from the given value.

pub fn from_iter<I>(arena: &'arena Arena, source: I) -> List<'arena, T> where
    I: IntoIterator<Item = T>, 
[src]

Create a list from an iterator of items.

pub fn prepend(&self, arena: &'arena Arena, value: T) -> &'arena T[src]

Adds a new element to the beginning of the list.

pub fn shift(&self) -> Option<&'arena T>[src]

Removes the first element from the list and returns it.

pub fn shift_ref(&mut self) -> Option<&'arena T>[src]

Get the first element of the List, if any, then create a new List starting from the second element at the reference to the old list.

Note: This does not modify the internal state of the List. If you wish to modify the list use shift instead.

Trait Implementations

impl<'a, 'b, A, B> PartialEq<List<'b, B>> for List<'a, A> where
    A: PartialEq<B>, 
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'arena, T: Copy> Copy for List<'arena, T>[src]

impl<'arena, T: Clone> Clone for List<'arena, T>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'arena, T> IntoIterator for List<'arena, T>[src]

type Item = &'arena T

The type of the elements being iterated over.

type IntoIter = ListIter<'arena, T>

Which kind of iterator are we turning this into?

impl<'a, 'arena, T> IntoIterator for &'a List<'arena, T>[src]

type Item = &'arena T

The type of the elements being iterated over.

type IntoIter = ListIter<'arena, T>

Which kind of iterator are we turning this into?

impl<'arena, T> Debug for List<'arena, T> where
    T: Debug
[src]

Auto Trait Implementations

impl<'arena, T> Send for List<'arena, T>

impl<'arena, T> !Sync for List<'arena, T>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]