Struct c_linked_list::CLinkedListMut [−][src]
Wraps a C linked list comprised of mutable pointers between nodes.
Methods
impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> CLinkedListMut<T, N>
[src]
impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> CLinkedListMut<T, N>
pub unsafe fn from_ptr(head: *mut T, next: N) -> CLinkedListMut<T, N>
[src]
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.
ⓘImportant traits for CLinkedListMutIter<'a, T, N>pub fn iter(&'a self) -> CLinkedListMutIter<'a, T, N>
[src]
pub fn iter(&'a self) -> CLinkedListMutIter<'a, T, N>
Iterate over the linked list, returning references to the nodes of the list.
ⓘImportant traits for CLinkedListMutIterMut<'a, T, N>pub fn iter_mut(&'a mut self) -> CLinkedListMutIterMut<'a, T, N>
[src]
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.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true
if the list is empty.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Calculates the length of the list. This is an O(n)
operation.
pub fn front(&self) -> Option<&T>
[src]
pub fn front(&self) -> Option<&T>
Provides a reference to the front element in the list, or None
if the list is empty.
pub fn front_mut(&self) -> Option<&mut T>
[src]
pub fn front_mut(&self) -> Option<&mut T>
Provides a mutable reference to the front element in the list, or None
if the list is
empty.
Trait Implementations
impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> IntoIterator for &'a CLinkedListMut<T, N>
[src]
impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> IntoIterator for &'a CLinkedListMut<T, N>
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = CLinkedListMutIter<'a, T, N>
Which kind of iterator are we turning this into?
ⓘImportant traits for CLinkedListMutIter<'a, T, N>fn into_iter(self) -> CLinkedListMutIter<'a, T, N>
[src]
fn into_iter(self) -> CLinkedListMutIter<'a, T, N>
Creates an iterator from a value. Read more
impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> IntoIterator for &'a mut CLinkedListMut<T, N>
[src]
impl<'a, T: 'a, N: Fn(&T) -> *mut T + 'a> IntoIterator for &'a mut CLinkedListMut<T, N>
type Item = &'a mut T
The type of the elements being iterated over.
type IntoIter = CLinkedListMutIterMut<'a, T, N>
Which kind of iterator are we turning this into?
ⓘImportant traits for CLinkedListMutIterMut<'a, T, N>fn into_iter(self) -> CLinkedListMutIterMut<'a, T, N>
[src]
fn into_iter(self) -> CLinkedListMutIterMut<'a, T, N>
Creates an iterator from a value. Read more
impl<'a, T: Debug + 'a, N: Fn(&T) -> *mut T + 'a> Debug for CLinkedListMut<T, N>
[src]
impl<'a, T: Debug + 'a, N: Fn(&T) -> *mut T + 'a> Debug for CLinkedListMut<T, N>
Auto Trait Implementations
impl<T, N> !Send for CLinkedListMut<T, N>
impl<T, N> !Send for CLinkedListMut<T, N>
impl<T, N> !Sync for CLinkedListMut<T, N>
impl<T, N> !Sync for CLinkedListMut<T, N>