Struct toolshed::list::List
[−]
[src]
pub struct List<'arena, T: 'arena> { /* fields omitted */ }
A single-ended linked list.
Methods
impl<'arena, T: 'arena> List<'arena, T>
[src]
fn empty() -> Self
[src]
Create a new empty List
.
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.
fn iter(&self) -> ListIter<'arena, T>
[src]
Returns an iterator over the items in the list.
fn is_empty(&self) -> bool
[src]
Checks if the list is empty.
fn only_element(&self) -> Option<&'arena T>
[src]
Returns the first element if, and only if, the list contains just that single element.
fn first_element(&self) -> Option<&'arena T>
[src]
Returns the reference to the first element.
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: 'arena + Copy> List<'arena, T>
[src]
fn from(arena: &'arena Arena, value: T) -> List<'arena, T>
[src]
Create a single-element list from the given value.
fn from_iter<I>(arena: &'arena Arena, source: I) -> List<'arena, T> where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
Create a list from an iterator of items.
fn prepend(&self, arena: &'arena Arena, value: T) -> &'arena T
[src]
Adds a new element to the beginning of the list.
fn shift(&self) -> Option<&'arena T>
[src]
Removes the first element from the list and returns it.
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<'arena, T: Clone + 'arena> Clone for List<'arena, T>
[src]
fn clone(&self) -> List<'arena, T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'arena, T: Copy> Copy for List<'arena, T>
[src]
impl<'arena, T: 'arena> 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?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<'a, 'arena, T: 'arena> 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?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<'a, 'b, A, B> PartialEq<List<'b, B>> for List<'a, A> where
A: PartialEq<B>,
[src]
A: PartialEq<B>,
fn eq(&self, other: &List<'b, B>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'arena, T> Debug for List<'arena, T> where
T: Debug,
[src]
T: Debug,