pub struct LinkedList<L, T> { /* private fields */ }
Expand description

An intrusive linked list.

Currently, the list is not emptied on drop. It is the caller’s responsibility to ensure the list is empty before dropping it.

Implementations§

source§

impl<L, T> LinkedList<L, T>

source

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

Creates an empty linked list.

source§

impl<L: Link> LinkedList<L, L::Target>

source

pub fn push_front(&mut self, val: L::Handle)

Adds an element first in the list.

source

pub fn is_empty(&self) -> bool

Returns whether the linked list does not contain any node

source

pub unsafe fn remove(&mut self, node: NonNull<L::Target>) -> Option<L::Handle>

Removes the specified node from the list

Safety

The caller must ensure that node is currently contained by self or not contained by any other list.

source

pub fn iter(&self) -> impl Iterator<Item = &L::Target>

source§

impl<T: Link> LinkedList<T, T::Target>

source

pub fn drain_filter<F>(&mut self, filter: F) -> DrainFilter<'_, T, F> where F: FnMut(&mut T::Target) -> bool,

Trait Implementations§

source§

impl<L: Link> Debug for LinkedList<L, L::Target>

source§

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

Formats the value using the given formatter. Read more
source§

impl<L: Link> Default for LinkedList<L, L::Target>

source§

fn default() -> Self

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

impl<L: Link> Send for LinkedList<L, L::Target>where L::Target: Send,

source§

impl<L: Link> Sync for LinkedList<L, L::Target>where L::Target: Sync,

Auto Trait Implementations§

§

impl<L, T> RefUnwindSafe for LinkedList<L, T>where L: RefUnwindSafe, T: RefUnwindSafe,

§

impl<L, T> Unpin for LinkedList<L, T>

§

impl<L, T> UnwindSafe for LinkedList<L, T>where L: RefUnwindSafe, T: RefUnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T, U> ExactFrom<T> for Uwhere U: TryFrom<T>,

source§

fn exact_from(value: T) -> U

source§

impl<T, U> ExactInto<U> for Twhere U: ExactFrom<T>,

source§

fn exact_into(self) -> U

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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, U> OverflowingInto<U> for Twhere U: OverflowingFrom<T>,

source§

impl<T, U> RoundingInto<U> for Twhere U: RoundingFrom<T>,

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> SaturatingInto<U> for Twhere U: SaturatingFrom<T>,

source§

impl<T> ToDebugString for Twhere T: Debug,

source§

fn to_debug_string(&self) -> String

Returns the String produced by Ts Debug implementation.

Examples
use malachite_base::strings::ToDebugString;

assert_eq!([1, 2, 3].to_debug_string(), "[1, 2, 3]");
assert_eq!(
    [vec![2, 3], vec![], vec![4]].to_debug_string(),
    "[[2, 3], [], [4]]"
);
assert_eq!(Some(5).to_debug_string(), "Some(5)");
source§

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

§

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 Twhere U: TryFrom<T>,

§

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<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T, U> WrappingInto<U> for Twhere U: WrappingFrom<T>,

source§

fn wrapping_into(self) -> U