Struct LinkedList

1.0.0 ยท Source
pub struct LinkedList<T, A = Global>
where A: Allocator,
{ /* private fields */ }
Available on crate feature alloc only.
Expand description

๐Ÿ“ฆ alloc A doubly-linked list with owned nodes.

Re-exported from [alloc]::collections:: .


A doubly-linked list with owned nodes.

The LinkedList allows pushing and popping elements at either end in constant time.

A LinkedList with a known list of items can be initialized from an array:

use std::collections::LinkedList;

let list = LinkedList::from([1, 2, 3]);

NOTE: It is almost always better to use Vec or VecDeque because array-based containers are generally faster, more memory efficient, and make better use of CPU cache.

Implementationsยง

Sourceยง

impl<T> LinkedList<T>

1.0.0 (const: 1.39.0) ยท Source

pub const fn new() -> LinkedList<T>

Creates an empty LinkedList.

ยงExamples
use std::collections::LinkedList;

let list: LinkedList<u32> = LinkedList::new();
1.0.0 ยท Source

pub fn append(&mut self, other: &mut LinkedList<T>)

Moves all elements from other to the end of the list.

This reuses all the nodes from other and moves them into self. After this operation, other becomes empty.

This operation should compute in O(1) time and O(1) memory.

ยงExamples
use std::collections::LinkedList;

let mut list1 = LinkedList::new();
list1.push_back('a');

let mut list2 = LinkedList::new();
list2.push_back('b');
list2.push_back('c');

list1.append(&mut list2);

let mut iter = list1.iter();
assert_eq!(iter.next(), Some(&'a'));
assert_eq!(iter.next(), Some(&'b'));
assert_eq!(iter.next(), Some(&'c'));
assert!(iter.next().is_none());

assert!(list2.is_empty());
Sourceยง

impl<T, A> LinkedList<T, A>
where A: Allocator,

Source

pub const fn new_in(alloc: A) -> LinkedList<T, A>

๐Ÿ”ฌThis is a nightly-only experimental API. (allocator_api)

Constructs an empty LinkedList<T, A>.

ยงExamples
#![feature(allocator_api)]

use std::alloc::System;
use std::collections::LinkedList;

let list: LinkedList<u32, _> = LinkedList::new_in(System);
1.0.0 ยท Source

pub fn iter(&self) -> Iter<'_, T> โ“˜

Provides a forward iterator.

ยงExamples
use std::collections::LinkedList;

let mut list: LinkedList<u32> = LinkedList::new();

list.push_back(0);
list.push_back(1);
list.push_back(2);

let mut iter = list.iter();
assert_eq!(iter.next(), Some(&0));
assert_eq!(iter.next(), Some(&1));
assert_eq!(iter.next(), Some(&2));
assert_eq!(iter.next(), None);
1.0.0 ยท Source

pub fn iter_mut(&mut self) -> IterMut<'_, T> โ“˜

Provides a forward iterator with mutable references.

ยงExamples
use std::collections::LinkedList;

let mut list: LinkedList<u32> = LinkedList::new();

list.push_back(0);
list.push_back(1);
list.push_back(2);

for element in list.iter_mut() {
    *element += 10;
}

let mut iter = list.iter();
assert_eq!(iter.next(), Some(&10));
assert_eq!(iter.next(), Some(&11));
assert_eq!(iter.next(), Some(&12));
assert_eq!(iter.next(), None);
Source

pub fn cursor_front(&self) -> Cursor<'_, T, A>

๐Ÿ”ฌThis is a nightly-only experimental API. (linked_list_cursors)

Provides a cursor at the front element.

The cursor is pointing to the โ€œghostโ€ non-element if the list is empty.

Source

pub fn cursor_front_mut(&mut self) -> CursorMut<'_, T, A>

๐Ÿ”ฌThis is a nightly-only experimental API. (linked_list_cursors)

Provides a cursor with editing operations at the front element.

The cursor is pointing to the โ€œghostโ€ non-element if the list is empty.

Source

pub fn cursor_back(&self) -> Cursor<'_, T, A>

๐Ÿ”ฌThis is a nightly-only experimental API. (linked_list_cursors)

Provides a cursor at the back element.

The cursor is pointing to the โ€œghostโ€ non-element if the list is empty.

Source

pub fn cursor_back_mut(&mut self) -> CursorMut<'_, T, A>

๐Ÿ”ฌThis is a nightly-only experimental API. (linked_list_cursors)

Provides a cursor with editing operations at the back element.

The cursor is pointing to the โ€œghostโ€ non-element if the list is empty.

1.0.0 ยท Source

pub fn is_empty(&self) -> bool

Returns true if the LinkedList is empty.

This operation should compute in O(1) time.

ยงExamples
use std::collections::LinkedList;

let mut dl = LinkedList::new();
assert!(dl.is_empty());

dl.push_front("foo");
assert!(!dl.is_empty());
1.0.0 ยท Source

pub fn len(&self) -> usize

Returns the length of the LinkedList.

This operation should compute in O(1) time.

ยงExamples
use std::collections::LinkedList;

let mut dl = LinkedList::new();

dl.push_front(2);
assert_eq!(dl.len(), 1);

dl.push_front(1);
assert_eq!(dl.len(), 2);

dl.push_back(3);
assert_eq!(dl.len(), 3);
1.0.0 ยท Source

pub fn clear(&mut self)

Removes all elements from the LinkedList.

This operation should compute in O(n) time.

ยงExamples
use std::collections::LinkedList;

let mut dl = LinkedList::new();

dl.push_front(2);
dl.push_front(1);
assert_eq!(dl.len(), 2);
assert_eq!(dl.front(), Some(&1));

dl.clear();
assert_eq!(dl.len(), 0);
assert_eq!(dl.front(), None);
1.12.0 ยท Source

pub fn contains(&self, x: &T) -> bool
where T: PartialEq,

Returns true if the LinkedList contains an element equal to the given value.

This operation should compute linearly in O(n) time.

ยงExamples
use std::collections::LinkedList;

let mut list: LinkedList<u32> = LinkedList::new();

list.push_back(0);
list.push_back(1);
list.push_back(2);

assert_eq!(list.contains(&0), true);
assert_eq!(list.contains(&10), false);
1.0.0 ยท Source

pub fn front(&self) -> Option<&T> โ“˜

Provides a reference to the front element, or None if the list is empty.

This operation should compute in O(1) time.

ยงExamples
use std::collections::LinkedList;

let mut dl = LinkedList::new();
assert_eq!(dl.front(), None);

dl.push_front(1);
assert_eq!(dl.front(), Some(&1));
1.0.0 ยท Source

pub fn front_mut(&mut self) -> Option<&mut T> โ“˜

Provides a mutable reference to the front element, or None if the list is empty.

This operation should compute in O(1) time.

ยงExamples
use std::collections::LinkedList;

let mut dl = LinkedList::new();
assert_eq!(dl.front(), None);

dl.push_front(1);
assert_eq!(dl.front(), Some(&1));

match dl.front_mut() {
    None => {},
    Some(x) => *x = 5,
}
assert_eq!(dl.front(), Some(&5));
1.0.0 ยท Source

pub fn back(&self) -> Option<&T> โ“˜

Provides a reference to the back element, or None if the list is empty.

This operation should compute in O(1) time.

ยงExamples
use std::collections::LinkedList;

let mut dl = LinkedList::new();
assert_eq!(dl.back(), None);

dl.push_back(1);
assert_eq!(dl.back(), Some(&1));
1.0.0 ยท Source

pub fn back_mut(&mut self) -> Option<&mut T> โ“˜

Provides a mutable reference to the back element, or None if the list is empty.

This operation should compute in O(1) time.

ยงExamples
use std::collections::LinkedList;

let mut dl = LinkedList::new();
assert_eq!(dl.back(), None);

dl.push_back(1);
assert_eq!(dl.back(), Some(&1));

match dl.back_mut() {
    None => {},
    Some(x) => *x = 5,
}
assert_eq!(dl.back(), Some(&5));
1.0.0 ยท Source

pub fn push_front(&mut self, elt: T)

Adds an element first in the list.

This operation should compute in O(1) time.

ยงExamples
use std::collections::LinkedList;

let mut dl = LinkedList::new();

dl.push_front(2);
assert_eq!(dl.front().unwrap(), &2);

dl.push_front(1);
assert_eq!(dl.front().unwrap(), &1);
1.0.0 ยท Source

pub fn pop_front(&mut self) -> Option<T> โ“˜

Removes the first element and returns it, or None if the list is empty.

This operation should compute in O(1) time.

ยงExamples
use std::collections::LinkedList;

let mut d = LinkedList::new();
assert_eq!(d.pop_front(), None);

d.push_front(1);
d.push_front(3);
assert_eq!(d.pop_front(), Some(3));
assert_eq!(d.pop_front(), Some(1));
assert_eq!(d.pop_front(), None);
1.0.0 ยท Source

pub fn push_back(&mut self, elt: T)

Appends an element to the back of a list.

This operation should compute in O(1) time.

ยงExamples
use std::collections::LinkedList;

let mut d = LinkedList::new();
d.push_back(1);
d.push_back(3);
assert_eq!(3, *d.back().unwrap());
1.0.0 ยท Source

pub fn pop_back(&mut self) -> Option<T> โ“˜

Removes the last element from a list and returns it, or None if it is empty.

This operation should compute in O(1) time.

ยงExamples
use std::collections::LinkedList;

let mut d = LinkedList::new();
assert_eq!(d.pop_back(), None);
d.push_back(1);
d.push_back(3);
assert_eq!(d.pop_back(), Some(3));
1.0.0 ยท Source

pub fn split_off(&mut self, at: usize) -> LinkedList<T, A>
where A: Clone,

Splits the list into two at the given index. Returns everything after the given index, including the index.

This operation should compute in O(n) time.

ยงPanics

Panics if at > len.

ยงExamples
use std::collections::LinkedList;

let mut d = LinkedList::new();

d.push_front(1);
d.push_front(2);
d.push_front(3);

let mut split = d.split_off(2);

assert_eq!(split.pop_front(), Some(1));
assert_eq!(split.pop_front(), None);
Source

pub fn remove(&mut self, at: usize) -> T

๐Ÿ”ฌThis is a nightly-only experimental API. (linked_list_remove)

Removes the element at the given index and returns it.

This operation should compute in O(n) time.

ยงPanics

Panics if at >= len

ยงExamples
#![feature(linked_list_remove)]
use std::collections::LinkedList;

let mut d = LinkedList::new();

d.push_front(1);
d.push_front(2);
d.push_front(3);

assert_eq!(d.remove(1), 2);
assert_eq!(d.remove(0), 3);
assert_eq!(d.remove(0), 1);
Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&T) -> bool,

๐Ÿ”ฌThis is a nightly-only experimental API. (linked_list_retain)

Retains only the elements specified by the predicate.

In other words, remove all elements e for which f(&e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.

ยงExamples
#![feature(linked_list_retain)]
use std::collections::LinkedList;

let mut d = LinkedList::new();

d.push_front(1);
d.push_front(2);
d.push_front(3);

d.retain(|&x| x % 2 == 0);

assert_eq!(d.pop_front(), Some(2));
assert_eq!(d.pop_front(), None);

Because the elements are visited exactly once in the original order, external state may be used to decide which elements to keep.

#![feature(linked_list_retain)]
use std::collections::LinkedList;

let mut d = LinkedList::new();

d.push_front(1);
d.push_front(2);
d.push_front(3);

let keep = [false, true, false];
let mut iter = keep.iter();
d.retain(|_| *iter.next().unwrap());
assert_eq!(d.pop_front(), Some(2));
assert_eq!(d.pop_front(), None);
Source

pub fn retain_mut<F>(&mut self, f: F)
where F: FnMut(&mut T) -> bool,

๐Ÿ”ฌThis is a nightly-only experimental API. (linked_list_retain)

Retains only the elements specified by the predicate.

In other words, remove all elements e for which f(&mut e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.

ยงExamples
#![feature(linked_list_retain)]
use std::collections::LinkedList;

let mut d = LinkedList::new();

d.push_front(1);
d.push_front(2);
d.push_front(3);

d.retain_mut(|x| if *x % 2 == 0 {
    *x += 1;
    true
} else {
    false
});
assert_eq!(d.pop_front(), Some(3));
assert_eq!(d.pop_front(), None);
1.87.0 ยท Source

pub fn extract_if<F>(&mut self, filter: F) -> ExtractIf<'_, T, F, A> โ“˜
where F: FnMut(&mut T) -> bool,

Creates an iterator which uses a closure to determine if an element should be removed.

If the closure returns true, then the element is removed and yielded. If the closure returns false, the element will remain in the list and will not be yielded by the iterator.

If the returned ExtractIf is not exhausted, e.g. because it is dropped without iterating or the iteration short-circuits, then the remaining elements will be retained. Use extract_if().for_each(drop) if you do not need the returned iterator.

Note that extract_if lets you mutate every element in the filter closure, regardless of whether you choose to keep or remove it.

ยงExamples

Splitting a list into evens and odds, reusing the original list:

use std::collections::LinkedList;

let mut numbers: LinkedList<u32> = LinkedList::new();
numbers.extend(&[1, 2, 3, 4, 5, 6, 8, 9, 11, 13, 14, 15]);

let evens = numbers.extract_if(|x| *x % 2 == 0).collect::<LinkedList<_>>();
let odds = numbers;

assert_eq!(evens.into_iter().collect::<Vec<_>>(), vec![2, 4, 6, 8, 14]);
assert_eq!(odds.into_iter().collect::<Vec<_>>(), vec![1, 3, 5, 9, 11, 13, 15]);

Trait Implementationsยง

Sourceยง

impl<T> BitSized<{$PTR_BITS * 3}> for LinkedList<T>

Sourceยง

const BIT_SIZE: usize = _

The bit size of this type (only the relevant data part, without padding). Read more
Sourceยง

const MIN_BYTE_SIZE: usize = _

The rounded up byte size for this type. Read more
Sourceยง

fn bit_size(&self) -> usize

Returns the bit size of this type (only the relevant data part, without padding). Read more
Sourceยง

fn min_byte_size(&self) -> usize

Returns the rounded up byte size for this type. Read more
1.0.0 ยท Sourceยง

impl<T, A> Clone for LinkedList<T, A>
where T: Clone, A: Allocator + Clone,

Sourceยง

fn clone_from(&mut self, source: &LinkedList<T, A>)

Overwrites the contents of self with a clone of the contents of source.

This method is preferred over simply assigning source.clone() to self, as it avoids reallocation of the nodes of the linked list. Additionally, if the element type T overrides clone_from(), this will reuse the resources of selfโ€™s elements as well.

Sourceยง

fn clone(&self) -> LinkedList<T, A>

Returns a copy of the value. Read more
Sourceยง

impl<T> ConstDefault for LinkedList<T>

Sourceยง

const DEFAULT: Self

Returns the compile-time โ€œdefault valueโ€ for a type.
1.0.0 ยท Sourceยง

impl<T, A> Debug for LinkedList<T, A>
where T: Debug, A: Allocator,

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> โ“˜

Formats the value using the given formatter. Read more
1.0.0 ยท Sourceยง

impl<T> Default for LinkedList<T>

Sourceยง

fn default() -> LinkedList<T>

Creates an empty LinkedList<T>.

Sourceยง

impl<'de, T> Deserialize<'de> for LinkedList<T>
where T: Deserialize<'de>,

Sourceยง

fn deserialize<D>( deserializer: D, ) -> Result<LinkedList<T>, <D as Deserializer<'de>>::Error> โ“˜
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
1.0.0 ยท Sourceยง

impl<T, A> Drop for LinkedList<T, A>
where A: Allocator,

Sourceยง

fn drop(&mut self)

Executes the destructor for this type. Read more
1.2.0 ยท Sourceยง

impl<'a, T, A> Extend<&'a T> for LinkedList<T, A>
where T: 'a + Copy, A: Allocator,

Sourceยง

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = &'a T>,

Extends a collection with the contents of an iterator. Read more
Sourceยง

fn extend_one(&mut self, _: &'a T)

๐Ÿ”ฌThis is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Sourceยง

fn extend_reserve(&mut self, additional: usize)

๐Ÿ”ฌThis is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
1.0.0 ยท Sourceยง

impl<T, A> Extend<T> for LinkedList<T, A>
where A: Allocator,

Sourceยง

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = T>,

Extends a collection with the contents of an iterator. Read more
Sourceยง

fn extend_one(&mut self, elem: T)

๐Ÿ”ฌThis is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Sourceยง

fn extend_reserve(&mut self, additional: usize)

๐Ÿ”ฌThis is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
1.56.0 ยท Sourceยง

impl<T, const N: usize> From<[T; N]> for LinkedList<T>

Sourceยง

fn from(arr: [T; N]) -> LinkedList<T>

Converts a [T; N] into a LinkedList<T>.

use std::collections::LinkedList;

let list1 = LinkedList::from([1, 2, 3, 4]);
let list2: LinkedList<_> = [1, 2, 3, 4].into();
assert_eq!(list1, list2);
1.0.0 ยท Sourceยง

impl<T> FromIterator<T> for LinkedList<T>

Sourceยง

fn from_iter<I>(iter: I) -> LinkedList<T>
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
ยง

impl<T> FromParallelIterator<T> for LinkedList<T>
where T: Send,

Collects items from a parallel iterator into a freshly allocated linked list.

ยง

fn from_par_iter<I>(par_iter: I) -> LinkedList<T>
where I: IntoParallelIterator<Item = T>,

Creates an instance of the collection from the parallel iterator par_iter. Read more
1.0.0 ยท Sourceยง

impl<T, A> Hash for LinkedList<T, A>
where T: Hash, A: Allocator,

Sourceยง

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 ยท Sourceยง

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
1.0.0 ยท Sourceยง

impl<'a, T, A> IntoIterator for &'a LinkedList<T, A>
where A: Allocator,

Sourceยง

type Item = &'a T

The type of the elements being iterated over.
Sourceยง

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
Sourceยง

fn into_iter(self) -> Iter<'a, T> โ“˜

Creates an iterator from a value. Read more
1.0.0 ยท Sourceยง

impl<'a, T, A> IntoIterator for &'a mut LinkedList<T, A>
where A: Allocator,

Sourceยง

type Item = &'a mut T

The type of the elements being iterated over.
Sourceยง

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
Sourceยง

fn into_iter(self) -> IterMut<'a, T> โ“˜

Creates an iterator from a value. Read more
1.0.0 ยท Sourceยง

impl<T, A> IntoIterator for LinkedList<T, A>
where A: Allocator,

Sourceยง

fn into_iter(self) -> IntoIter<T, A> โ“˜

Consumes the list into an iterator yielding elements by value.

Sourceยง

type Item = T

The type of the elements being iterated over.
Sourceยง

type IntoIter = IntoIter<T, A>

Which kind of iterator are we turning this into?
ยง

impl<'a, T> IntoParallelIterator for &'a LinkedList<T>
where T: Sync,

ยง

type Item = <&'a LinkedList<T> as IntoIterator>::Item

The type of item that the parallel iterator will produce.
ยง

type Iter = Iter<'a, T>

The parallel iterator type that will be created.
ยง

fn into_par_iter(self) -> <&'a LinkedList<T> as IntoParallelIterator>::Iter

Converts self into a parallel iterator. Read more
ยง

impl<'a, T> IntoParallelIterator for &'a mut LinkedList<T>
where T: Send,

ยง

type Item = <&'a mut LinkedList<T> as IntoIterator>::Item

The type of item that the parallel iterator will produce.
ยง

type Iter = IterMut<'a, T>

The parallel iterator type that will be created.
ยง

fn into_par_iter(self) -> <&'a mut LinkedList<T> as IntoParallelIterator>::Iter

Converts self into a parallel iterator. Read more
ยง

impl<T> IntoParallelIterator for LinkedList<T>
where T: Send,

ยง

type Item = <LinkedList<T> as IntoIterator>::Item

The type of item that the parallel iterator will produce.
ยง

type Iter = IntoIter<T>

The parallel iterator type that will be created.
ยง

fn into_par_iter(self) -> <LinkedList<T> as IntoParallelIterator>::Iter

Converts self into a parallel iterator. Read more
1.0.0 ยท Sourceยง

impl<T, A> Ord for LinkedList<T, A>
where T: Ord, A: Allocator,

Sourceยง

fn cmp(&self, other: &LinkedList<T, A>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 ยท Sourceยง

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 ยท Sourceยง

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 ยท Sourceยง

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
ยง

impl<'a, T> ParallelExtend<&'a T> for LinkedList<T>
where T: 'a + Copy + Send + Sync,

Extends a linked list with copied items from a parallel iterator.

ยง

fn par_extend<I>(&mut self, par_iter: I)
where I: IntoParallelIterator<Item = &'a T>,

Extends an instance of the collection with the elements drawn from the parallel iterator par_iter. Read more
ยง

impl<T> ParallelExtend<T> for LinkedList<T>
where T: Send,

Extends a linked list with items from a parallel iterator.

ยง

fn par_extend<I>(&mut self, par_iter: I)
where I: IntoParallelIterator<Item = T>,

Extends an instance of the collection with the elements drawn from the parallel iterator par_iter. Read more
1.0.0 ยท Sourceยง

impl<T, A> PartialEq for LinkedList<T, A>
where T: PartialEq, A: Allocator,

Sourceยง

fn eq(&self, other: &LinkedList<T, A>) -> bool

Tests for self and other values to be equal, and is used by ==.
Sourceยง

fn ne(&self, other: &LinkedList<T, A>) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.0.0 ยท Sourceยง

impl<T, A> PartialOrd for LinkedList<T, A>
where T: PartialOrd, A: Allocator,

Sourceยง

fn partial_cmp(&self, other: &LinkedList<T, A>) -> Option<Ordering> โ“˜

This method returns an ordering between self and other values if one exists. Read more
1.0.0 ยท Sourceยง

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 ยท Sourceยง

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 ยท Sourceยง

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 ยท Sourceยง

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Sourceยง

impl<T> Serialize for LinkedList<T>
where T: Serialize,

Sourceยง

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> โ“˜
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
1.0.0 ยท Sourceยง

impl<T, A> Eq for LinkedList<T, A>
where T: Eq, A: Allocator,

1.0.0 ยท Sourceยง

impl<T, A> Send for LinkedList<T, A>
where T: Send, A: Allocator + Send,

1.0.0 ยท Sourceยง

impl<T, A> Sync for LinkedList<T, A>
where T: Sync, A: Allocator + Sync,

Auto Trait Implementationsยง

ยง

impl<T, A> Freeze for LinkedList<T, A>
where A: Freeze,

ยง

impl<T, A> RefUnwindSafe for LinkedList<T, A>

ยง

impl<T, A> Unpin for LinkedList<T, A>
where A: Unpin,

ยง

impl<T, A> UnwindSafe for LinkedList<T, A>

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> ByteSized for T

Sourceยง

const BYTE_ALIGN: usize = _

The alignment of this type in bytes.
Sourceยง

const BYTE_SIZE: usize = _

The size of this type in bytes.
Sourceยง

fn byte_align(&self) -> usize

Returns the alignment of this type in bytes.
Sourceยง

fn byte_size(&self) -> usize

Returns the size of this type in bytes. Read more
Sourceยง

fn ptr_size_ratio(&self) -> [usize; 2]

Returns the size ratio between Ptr::BYTES and BYTE_SIZE. Read more
Sourceยง

impl<T, R> Chain<R> for T
where T: ?Sized,

Sourceยง

fn chain<F>(self, f: F) -> R
where F: FnOnce(Self) -> R, Self: Sized,

Chain a function which takes the parameter by value.
Sourceยง

fn chain_ref<F>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Chain a function which takes the parameter by shared reference.
Sourceยง

fn chain_mut<F>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Chain a function which takes the parameter by exclusive reference.
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dst: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
ยง

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

ยง

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
ยง

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

ยง

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Sourceยง

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

Sourceยง

fn type_id() -> TypeId

Returns the TypeId of Self. Read more
Sourceยง

fn type_of(&self) -> TypeId

Returns the TypeId of self. Read more
Sourceยง

fn type_name(&self) -> &'static str โ“˜

Returns the type name of self. Read more
Sourceยง

fn type_is<T: 'static>(&self) -> bool

Returns true if Self is of type T. Read more
Sourceยง

fn type_hash(&self) -> u64

Returns a deterministic hash of the TypeId of Self.
Sourceยง

fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64

Returns a deterministic hash of the TypeId of Self using a custom hasher.
Sourceยง

fn as_any_ref(&self) -> &dyn Any
where Self: Sized,

Upcasts &self as &dyn Any. Read more
Sourceยง

fn as_any_mut(&mut self) -> &mut dyn Any
where Self: Sized,

Upcasts &mut self as &mut dyn Any. Read more
Sourceยง

fn as_any_box(self: Box<Self>) -> Box<dyn Any>
where Self: Sized,

Upcasts Box<self> as Box<dyn Any>. Read more
Sourceยง

fn downcast_ref<T: 'static>(&self) -> Option<&T> โ“˜

Available on crate feature unsafe_layout only.
Returns some shared reference to the inner value if it is of type T. Read more
Sourceยง

fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> โ“˜

Available on crate feature unsafe_layout only.
Returns some exclusive reference to the inner value if it is of type T. Read more
Sourceยง

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

Sourceยง

const NEEDS_DROP: bool = _

Know whether dropping values of this type matters, in compile-time.
Sourceยง

fn mem_align_of<T>() -> usize

Returns the minimum alignment of the type in bytes. Read more
Sourceยง

fn mem_align_of_val(&self) -> usize

Returns the alignment of the pointed-to value in bytes. Read more
Sourceยง

fn mem_size_of<T>() -> usize

Returns the size of a type in bytes. Read more
Sourceยง

fn mem_size_of_val(&self) -> usize

Returns the size of the pointed-to value in bytes. Read more
Sourceยง

fn mem_copy(&self) -> Self
where Self: Copy,

Bitwise-copies a value. Read more
Sourceยง

fn mem_needs_drop(&self) -> bool

Returns true if dropping values of this type matters. Read more
Sourceยง

fn mem_drop(self)
where Self: Sized,

Drops self by running its destructor. Read more
Sourceยง

fn mem_forget(self)
where Self: Sized,

Forgets about self without running its destructor. Read more
Sourceยง

fn mem_replace(&mut self, other: Self) -> Self
where Self: Sized,

Replaces self with other, returning the previous value of self. Read more
Sourceยง

fn mem_take(&mut self) -> Self
where Self: Default,

Replaces self with its default value, returning the previous value of self. Read more
Sourceยง

fn mem_swap(&mut self, other: &mut Self)
where Self: Sized,

Swaps the value of self and other without deinitializing either one. Read more
Sourceยง

unsafe fn mem_zeroed<T>() -> T

Available on crate feature unsafe_layout only.
Returns the value of type T represented by the all-zero byte-pattern. Read more
Sourceยง

unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst

Available on crate feature unsafe_layout only.
Returns the value of type T represented by the all-zero byte-pattern. Read more
Sourceยง

fn mem_as_bytes(&self) -> &[u8] โ“˜
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.
View a Sync + Unpin self as &[u8]. Read more
Sourceยง

fn mem_as_bytes_mut(&mut self) -> &mut [u8] โ“˜
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.
View a Sync + Unpin self as &mut [u8]. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

ยง

impl<S> FromSample<S> for S

ยง

fn from_sample_(s: S) -> S

Sourceยง

impl<T> Hook for T

Sourceยง

fn hook_ref<F>(self, f: F) -> Self
where F: FnOnce(&Self),

Applies a function which takes the parameter by shared reference, and then returns the (possibly) modified owned value. Read more
Sourceยง

fn hook_mut<F>(self, f: F) -> Self
where F: FnOnce(&mut Self),

Applies a function which takes the parameter by exclusive reference, and then returns the (possibly) modified owned value. Read more
ยง

impl<T> Instrument for T

ยง

fn instrument(self, span: Span) -> Instrumented<Self> โ“˜

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
ยง

fn in_current_span(self) -> Instrumented<Self> โ“˜

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Sourceยง

fn into_either(self, into_left: bool) -> Either<Self, Self> โ“˜

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ“˜
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
ยง

impl<'data, I> IntoParallelRefIterator<'data> for I
where I: 'data + ?Sized, &'data I: IntoParallelIterator,

ยง

type Iter = <&'data I as IntoParallelIterator>::Iter

The type of the parallel iterator that will be returned.
ยง

type Item = <&'data I as IntoParallelIterator>::Item

The type of item that the parallel iterator will produce. This will typically be an &'data T reference type.
ยง

fn par_iter(&'data self) -> <I as IntoParallelRefIterator<'data>>::Iter

Converts self into a parallel iterator. Read more
ยง

impl<'data, I> IntoParallelRefMutIterator<'data> for I

ยง

type Iter = <&'data mut I as IntoParallelIterator>::Iter

The type of iterator that will be created.
ยง

type Item = <&'data mut I as IntoParallelIterator>::Item

The type of item that will be produced; this is typically an &'data mut T reference.
ยง

fn par_iter_mut( &'data mut self, ) -> <I as IntoParallelRefMutIterator<'data>>::Iter

Creates the parallel iterator from self. Read more
ยง

impl<'py, T, I> IntoPyDict<'py> for I
where T: PyDictItem<'py>, I: IntoIterator<Item = T>,

ยง

fn into_py_dict(self, py: Python<'py>) -> Result<Bound<'py, PyDict>, PyErr> โ“˜

Converts self into a PyDict object pointer. Whether pointer owned or borrowed depends on implementation.
ยง

fn into_py_dict_bound(self, py: Python<'py>) -> Bound<'py, PyDict>

๐Ÿ‘ŽDeprecated since 0.23.0: renamed to IntoPyDict::into_py_dict
Deprecated name for IntoPyDict::into_py_dict.
ยง

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

ยง

fn into_sample(self) -> T

ยง

impl<T> Pointable for T

ยง

const ALIGN: usize

The alignment of pointer.
ยง

type Init = T

The type for initializers.
ยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
ยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
ยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
ยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
ยง

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

ยง

fn to_sample_(self) -> U

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.
ยง

impl<T> WithSubscriber for T

ยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> โ“˜
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
ยง

fn with_current_subscriber(self) -> WithDispatch<Self> โ“˜

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

ยง

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

ยง

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