pub unsafe trait NtListElement<L: NtTypedList> {
    // Required method
    fn offset() -> usize;
}
Expand description

Designates a structure as a list element with an entry field (e.g. NtListEntry) of a particular NT list. The entry field’s position inside the list is given by implementing the offset method. The NT list is identified via the enum that implements NtTypedList.

You can implement this trait multiple times for a structure if it is part of multiple lists (and therefore contains multiple entry fields).

The easiest way to implement this trait for all entry fields of a structure is to use derive on the structure:

#[derive(NtListElement)]
#[repr(C)]
struct MyElement {
    entry: NtListEntry<Self, MyList>,
    value: i32,
}

Safety

This trait is unsafe, because the compiler cannot verify that the offset method has been implemented correctly. Safe functions rely on the offset pointing to an actual NtListEntry or NtSingleListEntry. This trait must also only be implemented for structures marked with #[repr(C)].

It is therefore recommended to only derive this trait as described above and never implement it manually.

Required Methods§

source

fn offset() -> usize

Returns the byte offset to the entry field relative to the beginning of the element structure.

Object Safety§

This trait is not object safe.

Implementors§