Struct c_linked_list::CLinkedListConst [] [src]

pub struct CLinkedListConst<T, N: Fn(&T) -> *const T> { /* fields omitted */ }

Wraps a C linked list comprised of const pointers between nodes.

Methods

impl<'a, T: 'a, N: Fn(&T) -> *const T + 'a> CLinkedListConst<T, N>
[src]

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.

Iterate over the linked list, returning immutable references to the nodes of the list.

Returns true if the list is empty.

Calculates the length of the list. This is an O(n) operation.

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

Trait Implementations

impl<'a, T: 'a, N: Fn(&T) -> *const T + 'a> IntoIterator for &'a CLinkedListConst<T, N>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<'a, T: Debug + 'a, N: Fn(&T) -> *const T + 'a> Debug for CLinkedListConst<T, N>
[src]

Formats the value using the given formatter.