[−][src]Struct c_linked_list::CLinkedListConst
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]
impl<'a, T: 'a, N: Fn(&T) -> *const T + 'a> CLinkedListConst<T, N>
pub unsafe fn from_ptr(head: *const T, next: N) -> CLinkedListConst<T, N>
[src]
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.
ⓘImportant traits for CLinkedListConstIter<'a, T, N>pub fn iter(&'a self) -> CLinkedListConstIter<'a, T, N>
[src]
pub fn iter(&'a self) -> CLinkedListConstIter<'a, T, N>
Iterate over the linked list, returning immutable 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.
Trait Implementations
impl<'a, T: 'a, N: Fn(&T) -> *const T + 'a> IntoIterator for &'a CLinkedListConst<T, N>
[src]
impl<'a, T: 'a, N: Fn(&T) -> *const T + 'a> IntoIterator for &'a CLinkedListConst<T, N>
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = CLinkedListConstIter<'a, T, N>
Which kind of iterator are we turning this into?
ⓘImportant traits for CLinkedListConstIter<'a, T, N>fn into_iter(self) -> CLinkedListConstIter<'a, T, N>
[src]
fn into_iter(self) -> CLinkedListConstIter<'a, T, N>
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]
impl<'a, T: Debug + 'a, N: Fn(&T) -> *const T + 'a> Debug for CLinkedListConst<T, N>
Auto Trait Implementations
impl<T, N> !Send for CLinkedListConst<T, N>
impl<T, N> !Send for CLinkedListConst<T, N>
impl<T, N> !Sync for CLinkedListConst<T, N>
impl<T, N> !Sync for CLinkedListConst<T, N>
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more