Struct caffe2_imports::IntrusiveLinkedList
source · pub struct IntrusiveLinkedList<A>where
A: Adapter,
<A as Adapter>::LinkOps: LinkedListOps,{ /* private fields */ }
Expand description
An intrusive doubly-linked list.
When this collection is dropped, all elements linked into it will be converted back to owned pointers and dropped.
Implementations§
source§impl<A> LinkedList<A>where
A: Adapter,
<A as Adapter>::LinkOps: LinkedListOps,
impl<A> LinkedList<A>where A: Adapter, <A as Adapter>::LinkOps: LinkedListOps,
sourcepub fn new(adapter: A) -> LinkedList<A>
pub fn new(adapter: A) -> LinkedList<A>
Creates an empty LinkedList
.
sourcepub fn cursor_mut(&mut self) -> CursorMut<'_, A>
pub fn cursor_mut(&mut self) -> CursorMut<'_, A>
Returns a null CursorMut
for this list.
sourcepub unsafe fn cursor_from_ptr(
&self,
ptr: *const <<A as Adapter>::PointerOps as PointerOps>::Value
) -> Cursor<'_, A>
pub unsafe fn cursor_from_ptr( &self, ptr: *const <<A as Adapter>::PointerOps as PointerOps>::Value ) -> Cursor<'_, A>
Creates a Cursor
from a pointer to an element.
Safety
ptr
must be a pointer to an object that is part of this list.
sourcepub unsafe fn cursor_mut_from_ptr(
&mut self,
ptr: *const <<A as Adapter>::PointerOps as PointerOps>::Value
) -> CursorMut<'_, A>
pub unsafe fn cursor_mut_from_ptr( &mut self, ptr: *const <<A as Adapter>::PointerOps as PointerOps>::Value ) -> CursorMut<'_, A>
Creates a CursorMut
from a pointer to an element.
Safety
ptr
must be a pointer to an object that is part of this list.
sourcepub fn front(&self) -> Cursor<'_, A>
pub fn front(&self) -> Cursor<'_, A>
Returns a Cursor
pointing to the first element of the list. If the
list is empty then a null cursor is returned.
sourcepub fn front_mut(&mut self) -> CursorMut<'_, A>
pub fn front_mut(&mut self) -> CursorMut<'_, A>
Returns a CursorMut
pointing to the first element of the list. If the
the list is empty then a null cursor is returned.
sourcepub fn back(&self) -> Cursor<'_, A>
pub fn back(&self) -> Cursor<'_, A>
Returns a Cursor
pointing to the last element of the list. If the list
is empty then a null cursor is returned.
sourcepub fn back_mut(&mut self) -> CursorMut<'_, A>
pub fn back_mut(&mut self) -> CursorMut<'_, A>
Returns a CursorMut
pointing to the last element of the list. If the
list is empty then a null cursor is returned.
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Removes all elements from the LinkedList
.
This will unlink all object currently in the list, which requires
iterating through all elements in the LinkedList
. Each element is
converted back to an owned pointer and then dropped.
sourcepub fn fast_clear(&mut self)
pub fn fast_clear(&mut self)
Empties the LinkedList
without unlinking or freeing objects in it.
Since this does not unlink any objects, any attempts to link these
objects into another LinkedList
will fail but will not cause any
memory unsafety. To unlink those objects manually, you must call the
force_unlink
function on them.
sourcepub fn take(&mut self) -> LinkedList<A>where
A: Clone,
pub fn take(&mut self) -> LinkedList<A>where A: Clone,
Takes all the elements out of the LinkedList
, leaving it empty.
The taken elements are returned as a new LinkedList
.
sourcepub fn push_front(
&mut self,
val: <<A as Adapter>::PointerOps as PointerOps>::Pointer
)
pub fn push_front( &mut self, val: <<A as Adapter>::PointerOps as PointerOps>::Pointer )
Inserts a new element at the start of the LinkedList
.
sourcepub fn push_back(
&mut self,
val: <<A as Adapter>::PointerOps as PointerOps>::Pointer
)
pub fn push_back( &mut self, val: <<A as Adapter>::PointerOps as PointerOps>::Pointer )
Inserts a new element at the end of the LinkedList
.
sourcepub fn pop_front(
&mut self
) -> Option<<<A as Adapter>::PointerOps as PointerOps>::Pointer>
pub fn pop_front( &mut self ) -> Option<<<A as Adapter>::PointerOps as PointerOps>::Pointer>
Removes the first element of the LinkedList
.
This returns None
if the LinkedList
is empty.
sourcepub fn pop_back(
&mut self
) -> Option<<<A as Adapter>::PointerOps as PointerOps>::Pointer>
pub fn pop_back( &mut self ) -> Option<<<A as Adapter>::PointerOps as PointerOps>::Pointer>
Removes the last element of the LinkedList
.
This returns None
if the LinkedList
is empty.
Trait Implementations§
source§impl<A> Debug for LinkedList<A>where
A: Adapter,
<A as Adapter>::LinkOps: LinkedListOps,
<<A as Adapter>::PointerOps as PointerOps>::Value: Debug,
impl<A> Debug for LinkedList<A>where A: Adapter, <A as Adapter>::LinkOps: LinkedListOps, <<A as Adapter>::PointerOps as PointerOps>::Value: Debug,
source§impl<A> Default for LinkedList<A>where
A: Adapter + Default,
<A as Adapter>::LinkOps: LinkedListOps,
impl<A> Default for LinkedList<A>where A: Adapter + Default, <A as Adapter>::LinkOps: LinkedListOps,
source§fn default() -> LinkedList<A>
fn default() -> LinkedList<A>
source§impl<A> Drop for LinkedList<A>where
A: Adapter,
<A as Adapter>::LinkOps: LinkedListOps,
impl<A> Drop for LinkedList<A>where A: Adapter, <A as Adapter>::LinkOps: LinkedListOps,
source§impl<'a, A> IntoIterator for &'a LinkedList<A>where
A: Adapter + 'a,
<A as Adapter>::LinkOps: LinkedListOps,
impl<'a, A> IntoIterator for &'a LinkedList<A>where A: Adapter + 'a, <A as Adapter>::LinkOps: LinkedListOps,
source§impl<A> IntoIterator for LinkedList<A>where
A: Adapter,
<A as Adapter>::LinkOps: LinkedListOps,
impl<A> IntoIterator for LinkedList<A>where A: Adapter, <A as Adapter>::LinkOps: LinkedListOps,
impl<A> Send for LinkedList<A>where A: Adapter + Send, <<A as Adapter>::PointerOps as PointerOps>::Pointer: Send, <A as Adapter>::LinkOps: LinkedListOps,
impl<A> Sync for LinkedList<A>where A: Adapter + Sync, <<A as Adapter>::PointerOps as PointerOps>::Value: Sync, <A as Adapter>::LinkOps: LinkedListOps,
Auto Trait Implementations§
impl<A> RefUnwindSafe for LinkedList<A>where A: RefUnwindSafe, <<A as Adapter>::LinkOps as LinkOps>::LinkPtr: RefUnwindSafe,
impl<A> Unpin for LinkedList<A>where A: Unpin, <<A as Adapter>::LinkOps as LinkOps>::LinkPtr: Unpin,
impl<A> UnwindSafe for LinkedList<A>where A: UnwindSafe, <<A as Adapter>::LinkOps as LinkOps>::LinkPtr: UnwindSafe,
Blanket Implementations§
source§impl<T, I> IntoPyDict for Iwhere
T: PyDictItem,
I: IntoIterator<Item = T>,
impl<T, I> IntoPyDict for Iwhere T: PyDictItem, I: IntoIterator<Item = T>,
source§fn into_py_dict(self, py: Python<'_>) -> &PyDict
fn into_py_dict(self, py: Python<'_>) -> &PyDict
PyDict
object pointer. Whether pointer owned or borrowed
depends on implementation.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.