pub struct SList<T: TransparentPtrType> { /* private fields */ }
Expand description
A list of items of type T
.
Behaves like an Iterator<Item = T>
but allows modifications.
Implementations§
Source§impl<T: TransparentPtrType> SList<T>
impl<T: TransparentPtrType> SList<T>
Sourcepub unsafe fn from_glib_none(list: *const GSList) -> SList<T>
pub unsafe fn from_glib_none(list: *const GSList) -> SList<T>
Create a new SList
around a list.
Sourcepub unsafe fn from_glib_container(list: *mut GSList) -> SList<T>
pub unsafe fn from_glib_container(list: *mut GSList) -> SList<T>
Create a new SList
around a list.
Sourcepub unsafe fn from_glib_full(list: *mut GSList) -> SList<T>
pub unsafe fn from_glib_full(list: *mut GSList) -> SList<T>
Create a new SList
around a list.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
Create a non-destructive mutable iterator over the SList
.
Sourcepub fn front(&self) -> Option<&T>
pub fn front(&self) -> Option<&T>
Returns a reference to the first item of the list, if any.
This operation is O(1)
.
Sourcepub fn front_mut(&mut self) -> Option<&mut T>
pub fn front_mut(&mut self) -> Option<&mut T>
Returns a mutable reference to the first item of the list, if any.
This operation is O(1)
.
Sourcepub fn pop_front(&mut self) -> Option<T>
pub fn pop_front(&mut self) -> Option<T>
Removes the front item from the list, if any.
This operation is O(1)
.
Sourcepub fn push_front(&mut self, item: T)
pub fn push_front(&mut self, item: T)
Prepends the new item to the front of the list.
This operation is O(1)
.
Sourcepub fn back(&self) -> Option<&T>
pub fn back(&self) -> Option<&T>
Returns a reference to the last item of the list, if any.
This operation is O(n)
.
Sourcepub fn back_mut(&mut self) -> Option<&mut T>
pub fn back_mut(&mut self) -> Option<&mut T>
Returns a mutable reference to the last item of the list, if any.
This operation is O(n)
.
Sourcepub fn pop_back(&mut self) -> Option<T>
pub fn pop_back(&mut self) -> Option<T>
Removes the back item from the list, if any.
This operation is O(n)
.
Sourcepub fn push_back(&mut self, item: T)
pub fn push_back(&mut self, item: T)
Appends the new item to the back of the list.
this operation is O(n)
.
Sourcepub fn sort_by<F: FnMut(&T, &T) -> Ordering>(&mut self, f: F)
pub fn sort_by<F: FnMut(&T, &T) -> Ordering>(&mut self, f: F)
Sorts the list.
This operation is O(n * log n)
.
Sourcepub fn retain(&mut self, f: impl FnMut(&T) -> bool)
pub fn retain(&mut self, f: impl FnMut(&T) -> bool)
Only keeps the item in the list for which f
returns true
.
Sourcepub fn as_mut_ptr(&mut self) -> *mut GSList
pub fn as_mut_ptr(&mut self) -> *mut GSList
Returns the underlying pointer.
Trait Implementations§
Source§impl<T: TransparentPtrType> Clone for SList<T>
impl<T: TransparentPtrType> Clone for SList<T>
Source§impl<T: TransparentPtrType> Default for SList<T>
impl<T: TransparentPtrType> Default for SList<T>
Source§impl<T: TransparentPtrType> Drop for SList<T>
impl<T: TransparentPtrType> Drop for SList<T>
Source§impl<T: TransparentPtrType> Extend<T> for SList<T>
impl<T: TransparentPtrType> Extend<T> for SList<T>
Source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl<T: TransparentPtrType> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *const GSList> for SList<T>
impl<T: TransparentPtrType> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *const GSList> for SList<T>
Source§impl<T: TransparentPtrType> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *mut GSList> for SList<T>
impl<T: TransparentPtrType> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *mut GSList> for SList<T>
Source§impl<T: TransparentPtrType> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *const GSList> for SList<T>
impl<T: TransparentPtrType> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *const GSList> for SList<T>
Source§unsafe fn from_glib_none(ptr: *const GSList) -> Self
unsafe fn from_glib_none(ptr: *const GSList) -> Self
Source§unsafe fn from_glib_container(_ptr: *const GSList) -> Self
unsafe fn from_glib_container(_ptr: *const GSList) -> Self
Source§unsafe fn from_glib_full(_ptr: *const GSList) -> Self
unsafe fn from_glib_full(_ptr: *const GSList) -> Self
Source§impl<T: TransparentPtrType> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *mut GSList> for SList<T>
impl<T: TransparentPtrType> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *mut GSList> for SList<T>
Source§unsafe fn from_glib_none(ptr: *mut GSList) -> Self
unsafe fn from_glib_none(ptr: *mut GSList) -> Self
Source§unsafe fn from_glib_container(ptr: *mut GSList) -> Self
unsafe fn from_glib_container(ptr: *mut GSList) -> Self
Source§unsafe fn from_glib_full(ptr: *mut GSList) -> Self
unsafe fn from_glib_full(ptr: *mut GSList) -> Self
Source§impl<T: TransparentPtrType> FromIterator<T> for SList<T>
impl<T: TransparentPtrType> FromIterator<T> for SList<T>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Source§impl<T: TransparentPtrType> IntoGlibPtr<*mut GSList> for SList<T>
impl<T: TransparentPtrType> IntoGlibPtr<*mut GSList> for SList<T>
Source§unsafe fn into_glib_ptr(self) -> *mut GSList
unsafe fn into_glib_ptr(self) -> *mut GSList
Source§impl<'a, T: TransparentPtrType> IntoIterator for &'a SList<T>
impl<'a, T: TransparentPtrType> IntoIterator for &'a SList<T>
Source§impl<'a, T: TransparentPtrType> IntoIterator for &'a mut SList<T>
impl<'a, T: TransparentPtrType> IntoIterator for &'a mut SList<T>
Source§impl<T: TransparentPtrType> IntoIterator for SList<T>
impl<T: TransparentPtrType> IntoIterator for SList<T>
Source§impl<'a, T: TransparentPtrType + 'a> ToGlibPtr<'a, *mut GSList> for SList<T>
impl<'a, T: TransparentPtrType + 'a> ToGlibPtr<'a, *mut GSList> for SList<T>
type Storage = PhantomData<&'a SList<T>>
Source§impl<'a, T: TransparentPtrType + 'a> ToGlibPtrMut<'a, *mut GSList> for SList<T>
impl<'a, T: TransparentPtrType + 'a> ToGlibPtrMut<'a, *mut GSList> for SList<T>
impl<T: Send + TransparentPtrType> Send for SList<T>
impl<T: Sync + TransparentPtrType> Sync for SList<T>
Auto Trait Implementations§
impl<T> Freeze for SList<T>
impl<T> RefUnwindSafe for SList<T>where
T: RefUnwindSafe,
impl<T> Unpin for SList<T>where
T: Unpin,
impl<T> UnwindSafe for SList<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)