pub struct UnsafeList<T, A: Adapter<T>> { /* private fields */ }Implementations§
Source§impl<T, A: Adapter<T>> UnsafeList<T, A>
impl<T, A: Adapter<T>> UnsafeList<T, A>
pub const fn new() -> Self
Sourcepub unsafe fn is_empty(&self) -> bool
pub unsafe fn is_empty(&self) -> bool
§Safety
It is up to the caller to ensure exclusive access to the list and its members.
Sourcepub unsafe fn is_element_linked(&self, element: NonNull<T>) -> bool
pub unsafe fn is_element_linked(&self, element: NonNull<T>) -> bool
Returns true if element is in ANY list that uses this list’s adapter.
§Safety
element must be a valid, non-null pointer.
Sourcepub unsafe fn push_front_unchecked(&mut self, element: NonNull<T>)
pub unsafe fn push_front_unchecked(&mut self, element: NonNull<T>)
Unchecked means:
- We don’t
assert!((*element_ptr.as_ptr()).is_unlinked()); - We don’t check that
elementis non-null.
§Safety
It is up to the caller to ensure exclusive access to the list and its members.
It is up to the caller to ensure the element is not in a list.
Sourcepub unsafe fn push_back_unchecked(&mut self, element: NonNull<T>)
pub unsafe fn push_back_unchecked(&mut self, element: NonNull<T>)
Unchecked means:
- We don’t
assert!((*element_ptr.as_ptr()).is_unlinked()); - We don’t check that
elementis non-null.
§Safety
It is up to the caller to ensure exclusive access to the list and its members.
It is up to the caller to ensure the element is not in a list.
Sourcepub unsafe fn unlink_element_unchecked(&mut self, element: NonNull<T>)
pub unsafe fn unlink_element_unchecked(&mut self, element: NonNull<T>)
Unlinks element from the linked list.
§Safety
It is up to the caller to ensure exclusive access to the list and its members.
It is up to the caller to ensure the element is in the list.
Sourcepub unsafe fn unlink_element(
&mut self,
element: NonNull<T>,
) -> Option<NonNull<T>>
pub unsafe fn unlink_element( &mut self, element: NonNull<T>, ) -> Option<NonNull<T>>
§Safety
The caller must ensure that the element points to a valid T.
Sourcepub unsafe fn for_each<E, F: FnMut(&T) -> Result<(), E>>(
&self,
callback: F,
) -> Result<(), E>
pub unsafe fn for_each<E, F: FnMut(&T) -> Result<(), E>>( &self, callback: F, ) -> Result<(), E>
§Safety
It is up to the caller to ensure exclusive access to the list and its members.
pub fn iter(&self) -> Iter<'_, T, A> ⓘ
Sourcepub unsafe fn filter<F: FnMut(&mut T) -> bool>(&mut self, callback: F)
pub unsafe fn filter<F: FnMut(&mut T) -> bool>(&mut self, callback: F)
Filter iterates over every element in the list calling callback on
each one. If callback returns false, the element will be removed
from the list without modifying the element itself. It is safe to
add the element to the another linked list within callback if it
returns false.
§Safety
It is up to the caller to ensure exclusive access to the list and its members.
Source§impl<T, A: Adapter<T>> UnsafeList<T, A>
impl<T, A: Adapter<T>> UnsafeList<T, A>
Sourcepub unsafe fn sorted_insert_by_unchecked<F: FnMut(&T, &T) -> Ordering>(
&mut self,
element: NonNull<T>,
compare: F,
)
pub unsafe fn sorted_insert_by_unchecked<F: FnMut(&T, &T) -> Ordering>( &mut self, element: NonNull<T>, compare: F, )
Unchecked means:
- We don’t
assert!((*element_ptr.as_ptr()).is_unlinked()); - We don’t check that
elementis non-null.
§Safety
It is up to the caller to ensure exclusive access to the list and its members.
It is up to the caller to ensure the element is not in a list.