#[repr(C)]
pub struct NtSingleListHead<E: NtListElement<L>, L: NtTypedList<T = NtSingleList>> { /* private fields */ }
Expand description

A singly linked list header compatible to SINGLE_LIST_ENTRY of the Windows NT API.

This variant requires elements to be allocated beforehand on a stable address and be valid as long as the list is used. As the Rust compiler cannot guarantee the validity of them, almost all NtSingleListHead functions are unsafe. You almost always want to use NtBoxingSingleListHead over this.

See the module-level documentation for more details.

This structure substitutes the SINGLE_LIST_ENTRY structure of the Windows NT API for the list header.

Implementations§

source§

impl<E, L> NtSingleListHead<E, L>
where E: NtListElement<L>, L: NtTypedList<T = NtSingleList>,

source

pub fn new() -> Self

Creates a new singly linked list.

source

pub fn clear(&mut self)

Removes all elements from the list.

This operation computes in O(1) time, because it only resets the forward link of the header.

source

pub unsafe fn front(&self) -> Option<&E>

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

This operation computes in O(1) time.

source

pub unsafe fn front_mut(&mut self) -> Option<&mut E>

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

This operation computes in O(1) time.

source

pub fn is_empty(&self) -> bool

Returns true if the list is empty.

This operation computes in O(1) time.

source

pub unsafe fn iter(&self) -> Iter<'_, E, L>

Returns an iterator yielding references to each element of the list.

source

pub unsafe fn iter_mut(&mut self) -> IterMut<'_, E, L>

Returns an iterator yielding mutable references to each element of the list.

source

pub unsafe fn len(&self) -> usize

Counts all elements and returns the length of the list.

This operation computes in O(n) time.

source

pub unsafe fn pop_front(&mut self) -> Option<&mut E>

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

This function substitutes PopEntryList of the Windows NT API.

This operation computes in O(1) time.

source

pub unsafe fn push_front(&mut self, element: &mut E)

Appends an element to the front of the list.

This function substitutes PushEntryList of the Windows NT API.

This operation computes in O(1) time.

source

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

Retains only the elements specified by the predicate, passing a mutable reference to it.

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.

This operation computes in O(n) time.

Trait Implementations§

source§

impl<E, L> Default for NtSingleListHead<E, L>
where E: NtListElement<L>, L: NtTypedList<T = NtSingleList>,

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<E, L> RefUnwindSafe for NtSingleListHead<E, L>

§

impl<E, L> !Send for NtSingleListHead<E, L>

§

impl<E, L> !Sync for NtSingleListHead<E, L>

§

impl<E, L> Unpin for NtSingleListHead<E, L>

§

impl<E, L> UnwindSafe for NtSingleListHead<E, L>

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, U> TryFrom<U> for T
where 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 T
where 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.