Struct intrusive_collections::xor_linked_list::XorLinkedList [−][src]
pub struct XorLinkedList<A: Adapter> where
A::LinkOps: XorLinkedListOps, { /* fields omitted */ }
Expand description
Intrusive xor doubly-linked list which uses less memory than a regular doubly linked list
In exchange for less memory use, it is impossible to create a cursor from a pointer to an element.
When this collection is dropped, all elements linked into it will be converted back to owned pointers and dropped.
Implementations
Creates an empty XorLinkedList
.
Returns a null CursorMut
for this list.
pub unsafe fn cursor_from_ptr_and_prev(
&self,
ptr: *const <A::PointerOps as PointerOps>::Value,
prev: *const <A::PointerOps as PointerOps>::Value
) -> Cursor<'_, A>
pub unsafe fn cursor_from_ptr_and_prev(
&self,
ptr: *const <A::PointerOps as PointerOps>::Value,
prev: *const <A::PointerOps as PointerOps>::Value
) -> Cursor<'_, A>
Creates a Cursor
from a pointer to an element and a pointer to the previous element.
Safety
ptr
must be a pointer to an object that is part of this list.
prev
must be a pointer to an object that is the previous object in this list (null for the head)
pub unsafe fn cursor_mut_from_ptr_and_prev(
&mut self,
ptr: *const <A::PointerOps as PointerOps>::Value,
prev: *const <A::PointerOps as PointerOps>::Value
) -> CursorMut<'_, A>
pub unsafe fn cursor_mut_from_ptr_and_prev(
&mut self,
ptr: *const <A::PointerOps as PointerOps>::Value,
prev: *const <A::PointerOps as PointerOps>::Value
) -> CursorMut<'_, A>
Creates a CursorMut
from a pointer to an element and a pointer to the previous element.
Safety
ptr
must be a pointer to an object that is part of this list.
prev
must be a pointer to an object that is the previous object in this list (null for the head)
pub unsafe fn cursor_from_ptr_and_next(
&self,
ptr: *const <A::PointerOps as PointerOps>::Value,
next: *const <A::PointerOps as PointerOps>::Value
) -> Cursor<'_, A>
pub unsafe fn cursor_from_ptr_and_next(
&self,
ptr: *const <A::PointerOps as PointerOps>::Value,
next: *const <A::PointerOps as PointerOps>::Value
) -> Cursor<'_, A>
Creates a Cursor
from a pointer to an element and a pointer to the next element.
Safety
ptr
must be a pointer to an object that is part of this list.
next
must be a pointer to an object that is the next object in this list (null for the tail)
pub unsafe fn cursor_mut_from_ptr_and_next(
&mut self,
ptr: *const <A::PointerOps as PointerOps>::Value,
next: *const <A::PointerOps as PointerOps>::Value
) -> CursorMut<'_, A>
pub unsafe fn cursor_mut_from_ptr_and_next(
&mut self,
ptr: *const <A::PointerOps as PointerOps>::Value,
next: *const <A::PointerOps as PointerOps>::Value
) -> CursorMut<'_, A>
Creates a CursorMut
from a pointer to an element and a pointer to the next element.
Safety
ptr
must be a pointer to an object that is part of this list.
next
must be a pointer to an object that is the next object in this list (null for the tail)
Returns a Cursor
pointing to the first element of the list. If the
list is empty then a null cursor is returned.
Returns a CursorMut
pointing to the first element of the list. If the
the list is empty then a null cursor is returned.
Returns a Cursor
pointing to the last element of the list. If the list
is empty then a null cursor is returned.
Returns a CursorMut
pointing to the last element of the list. If the
list is empty then a null cursor is returned.
pub fn iter(&self) -> Iter<'_, A>ⓘNotable traits for Iter<'a, A>impl<'a, A: Adapter + 'a> Iterator for Iter<'a, A> where
A::LinkOps: XorLinkedListOps, type Item = &'a <A::PointerOps as PointerOps>::Value;
pub fn iter(&self) -> Iter<'_, A>ⓘNotable traits for Iter<'a, A>impl<'a, A: Adapter + 'a> Iterator for Iter<'a, A> where
A::LinkOps: XorLinkedListOps, type Item = &'a <A::PointerOps as PointerOps>::Value;
impl<'a, A: Adapter + 'a> Iterator for Iter<'a, A> where
A::LinkOps: XorLinkedListOps, type Item = &'a <A::PointerOps as PointerOps>::Value;
Gets an iterator over the objects in the XorLinkedList
.
Removes all elements from the XorLinkedList
.
This will unlink all object currently in the list, which requires
iterating through all elements in the XorLinkedList
. Each element is
converted back to an owned pointer and then dropped.
Empties the XorLinkedList
without unlinking or freeing objects in it.
Since this does not unlink any objects, any attempts to link these
objects into another XorLinkedList
will fail but will not cause any
memory unsafety. To unlink those objects manually, you must call the
force_unlink
function on them.
Takes all the elements out of the XorLinkedList
, leaving it empty.
The taken elements are returned as a new XorLinkedList
.
Inserts a new element at the start of the XorLinkedList
.
Inserts a new element at the end of the XorLinkedList
.
Removes the first element of the XorLinkedList
.
This returns None
if the XorLinkedList
is empty.
Removes the last element of the XorLinkedList
.
This returns None
if the XorLinkedList
is empty.
Trait Implementations
impl<A: Adapter> Debug for XorLinkedList<A> where
A::LinkOps: XorLinkedListOps,
<A::PointerOps as PointerOps>::Value: Debug,
impl<A: Adapter> Debug for XorLinkedList<A> where
A::LinkOps: XorLinkedListOps,
<A::PointerOps as PointerOps>::Value: Debug,
Returns the “default value” for a type. Read more
type Item = <A::PointerOps as PointerOps>::Pointer
type Item = <A::PointerOps as PointerOps>::Pointer
The type of the elements being iterated over.
fn into_iter(self) -> IntoIter<A>ⓘNotable traits for IntoIter<A>impl<A: Adapter> Iterator for IntoIter<A> where
A::LinkOps: XorLinkedListOps, type Item = <A::PointerOps as PointerOps>::Pointer;
fn into_iter(self) -> IntoIter<A>ⓘNotable traits for IntoIter<A>impl<A: Adapter> Iterator for IntoIter<A> where
A::LinkOps: XorLinkedListOps, type Item = <A::PointerOps as PointerOps>::Pointer;
impl<A: Adapter> Iterator for IntoIter<A> where
A::LinkOps: XorLinkedListOps, type Item = <A::PointerOps as PointerOps>::Pointer;
Creates an iterator from a value. Read more
impl<'a, A: Adapter + 'a> IntoIterator for &'a XorLinkedList<A> where
A::LinkOps: XorLinkedListOps,
impl<'a, A: Adapter + 'a> IntoIterator for &'a XorLinkedList<A> where
A::LinkOps: XorLinkedListOps,
type Item = &'a <A::PointerOps as PointerOps>::Value
type Item = &'a <A::PointerOps as PointerOps>::Value
The type of the elements being iterated over.
fn into_iter(self) -> Iter<'a, A>ⓘNotable traits for Iter<'a, A>impl<'a, A: Adapter + 'a> Iterator for Iter<'a, A> where
A::LinkOps: XorLinkedListOps, type Item = &'a <A::PointerOps as PointerOps>::Value;
fn into_iter(self) -> Iter<'a, A>ⓘNotable traits for Iter<'a, A>impl<'a, A: Adapter + 'a> Iterator for Iter<'a, A> where
A::LinkOps: XorLinkedListOps, type Item = &'a <A::PointerOps as PointerOps>::Value;
impl<'a, A: Adapter + 'a> Iterator for Iter<'a, A> where
A::LinkOps: XorLinkedListOps, type Item = &'a <A::PointerOps as PointerOps>::Value;
Creates an iterator from a value. Read more