pub struct CLinkedListConst<T, N: Fn(&T) -> *const T> { /* private fields */ }Expand description
Wraps a C linked list comprised of const pointers between nodes.
Implementations§
Source§impl<'a, T: 'a, N: Fn(&T) -> *const T + 'a> CLinkedListConst<T, N>
impl<'a, T: 'a, N: Fn(&T) -> *const T + 'a> CLinkedListConst<T, N>
Sourcepub unsafe fn from_ptr(head: *const T, next: N) -> CLinkedListConst<T, N>
pub unsafe fn from_ptr(head: *const T, next: N) -> CLinkedListConst<T, N>
Construct a CLinkedListConst by wrapping a C linked list. head points to the head
element of the list or is NULL for a list of length 0. next is a function that takes a
node and returns a pointer to the next element.
§Example
To wrap this C type.
struct LinkedListNode {
int value;
const struct LinkedListNode *next;
};Call this function as CLinkedListConst::from_ptr(ptr_to_head, |n| n.next).
§Unsafety
This function is unsafe because it is up to the caller to ensure that head is valid.
Sourcepub fn iter(&'a self) -> CLinkedListConstIter<'a, T, N> ⓘ
pub fn iter(&'a self) -> CLinkedListConstIter<'a, T, N> ⓘ
Iterate over the linked list, returning immutable references to the nodes of the list.
Trait Implementations§
Source§impl<'a, T: 'a, N: Fn(&T) -> *const T + 'a> IntoIterator for &'a CLinkedListConst<T, N>
impl<'a, T: 'a, N: Fn(&T) -> *const T + 'a> IntoIterator for &'a CLinkedListConst<T, N>
Auto Trait Implementations§
impl<T, N> Freeze for CLinkedListConst<T, N>where
N: Freeze,
impl<T, N> RefUnwindSafe for CLinkedListConst<T, N>where
N: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, N> !Send for CLinkedListConst<T, N>
impl<T, N> !Sync for CLinkedListConst<T, N>
impl<T, N> Unpin for CLinkedListConst<T, N>where
N: Unpin,
impl<T, N> UnwindSafe for CLinkedListConst<T, N>where
N: UnwindSafe,
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more