pub struct CLinkedListMut<T, N: Fn(&T) -> *mut T> { /* private fields */ }Expand description
Wraps a C linked list comprised of mutable pointers between nodes.
Implementations§
Source§impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> CLinkedListMut<T, N>
impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> CLinkedListMut<T, N>
Sourcepub unsafe fn from_ptr(head: *mut T, next: N) -> CLinkedListMut<T, N>
pub unsafe fn from_ptr(head: *mut T, next: N) -> CLinkedListMut<T, N>
Construct a CLinkedListMut 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;
struct LinkedListNode *next;
};Call this function as CLinkedListMut::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) -> CLinkedListMutIter<'a, T, N> ⓘ
pub fn iter(&'a self) -> CLinkedListMutIter<'a, T, N> ⓘ
Iterate over the linked list, returning references to the nodes of the list.
Sourcepub fn iter_mut(&'a mut self) -> CLinkedListMutIterMut<'a, T, N> ⓘ
pub fn iter_mut(&'a mut self) -> CLinkedListMutIterMut<'a, T, N> ⓘ
Iterate over the linked list, returning mutable references to the nodes of the list.
Trait Implementations§
Source§impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> IntoIterator for &'a CLinkedListMut<T, N>
impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> IntoIterator for &'a CLinkedListMut<T, N>
Source§impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> IntoIterator for &'a mut CLinkedListMut<T, N>
impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> IntoIterator for &'a mut CLinkedListMut<T, N>
Auto Trait Implementations§
impl<T, N> Freeze for CLinkedListMut<T, N>where
N: Freeze,
impl<T, N> RefUnwindSafe for CLinkedListMut<T, N>where
N: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, N> !Send for CLinkedListMut<T, N>
impl<T, N> !Sync for CLinkedListMut<T, N>
impl<T, N> Unpin for CLinkedListMut<T, N>where
N: Unpin,
impl<T, N> UnwindSafe for CLinkedListMut<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