Struct SList
pub struct SList<T>where
T: TransparentPtrType,{ /* private fields */ }Expand description
A list of items of type T.
Behaves like an Iterator<Item = T> but allows modifications.
Implementations§
§impl<T> SList<T>where
T: TransparentPtrType,
impl<T> SList<T>where
T: TransparentPtrType,
pub 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.
pub 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.
pub 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.
pub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
Create a non-destructive mutable iterator over the SList.
pub 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).
pub 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).
pub 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).
pub 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).
pub 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).
pub 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).
pub 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).
pub 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).
pub fn reverse(&mut self)
pub fn reverse(&mut self)
Reverse the list.
This operation is O(n).
pub fn sort_by<F>(&mut self, f: F)
pub fn sort_by<F>(&mut self, f: F)
Sorts the list.
This operation is O(n * log n).
pub fn clear(&mut self)
pub fn clear(&mut self)
Removes all items from the list.
pub 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.
pub fn as_mut_ptr(&mut self) -> *mut GSList
pub fn as_mut_ptr(&mut self) -> *mut GSList
Returns the underlying pointer.
Trait Implementations§
§impl<T> Clone for SList<T>where
T: TransparentPtrType,
impl<T> Clone for SList<T>where
T: TransparentPtrType,
§impl<T> Default for SList<T>where
T: TransparentPtrType,
impl<T> Default for SList<T>where
T: TransparentPtrType,
§impl<T> Drop for SList<T>where
T: TransparentPtrType,
impl<T> Drop for SList<T>where
T: TransparentPtrType,
§impl<T> Extend<T> for SList<T>where
T: TransparentPtrType,
impl<T> Extend<T> for SList<T>where
T: TransparentPtrType,
§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
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)§impl<T> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *const GSList> for SList<T>where
T: TransparentPtrType,
impl<T> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *const GSList> for SList<T>where
T: TransparentPtrType,
§impl<T> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *mut GSList> for SList<T>where
T: TransparentPtrType,
impl<T> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *mut GSList> for SList<T>where
T: TransparentPtrType,
§impl<T> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *const GSList> for SList<T>where
T: TransparentPtrType,
impl<T> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *const GSList> for SList<T>where
T: TransparentPtrType,
§unsafe fn from_glib_none(ptr: *const GSList) -> SList<T>
unsafe fn from_glib_none(ptr: *const GSList) -> SList<T>
§unsafe fn from_glib_container(_ptr: *const GSList) -> SList<T>
unsafe fn from_glib_container(_ptr: *const GSList) -> SList<T>
§unsafe fn from_glib_full(_ptr: *const GSList) -> SList<T>
unsafe fn from_glib_full(_ptr: *const GSList) -> SList<T>
§impl<T> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *mut GSList> for SList<T>where
T: TransparentPtrType,
impl<T> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *mut GSList> for SList<T>where
T: TransparentPtrType,
§unsafe fn from_glib_none(ptr: *mut GSList) -> SList<T>
unsafe fn from_glib_none(ptr: *mut GSList) -> SList<T>
§unsafe fn from_glib_container(ptr: *mut GSList) -> SList<T>
unsafe fn from_glib_container(ptr: *mut GSList) -> SList<T>
§unsafe fn from_glib_full(ptr: *mut GSList) -> SList<T>
unsafe fn from_glib_full(ptr: *mut GSList) -> SList<T>
§impl<T> FromIterator<T> for SList<T>where
T: TransparentPtrType,
impl<T> FromIterator<T> for SList<T>where
T: TransparentPtrType,
§fn from_iter<I>(iter: I) -> SList<T>where
I: IntoIterator<Item = T>,
fn from_iter<I>(iter: I) -> SList<T>where
I: IntoIterator<Item = T>,
§impl<T> IntoGlibPtr<*mut GSList> for SList<T>where
T: TransparentPtrType,
impl<T> IntoGlibPtr<*mut GSList> for SList<T>where
T: TransparentPtrType,
§fn into_glib_ptr(self) -> *mut GSList
fn into_glib_ptr(self) -> *mut GSList
§impl<'a, T> IntoIterator for &'a SList<T>where
T: TransparentPtrType,
impl<'a, T> IntoIterator for &'a SList<T>where
T: TransparentPtrType,
§impl<'a, T> IntoIterator for &'a mut SList<T>where
T: TransparentPtrType,
impl<'a, T> IntoIterator for &'a mut SList<T>where
T: TransparentPtrType,
§impl<T> IntoIterator for SList<T>where
T: TransparentPtrType,
impl<T> IntoIterator for SList<T>where
T: TransparentPtrType,
§impl<'a, T> ToGlibPtr<'a, *const GSList> for SList<T>where
T: TransparentPtrType + 'a,
impl<'a, T> ToGlibPtr<'a, *const GSList> for SList<T>where
T: TransparentPtrType + 'a,
type Storage = PhantomData<&'a SList<T>>
§fn to_glib_container(&'a self) -> Stash<'a, P, Self>
fn to_glib_container(&'a self) -> Stash<'a, P, Self>
§fn to_glib_full(&self) -> P
fn to_glib_full(&self) -> P
§impl<'a, T> ToGlibPtrMut<'a, *mut GSList> for SList<T>where
T: TransparentPtrType + 'a,
impl<'a, T> ToGlibPtrMut<'a, *mut GSList> for SList<T>where
T: TransparentPtrType + 'a,
impl<T> Send for SList<T>where
T: Send + TransparentPtrType,
impl<T> Sync for SList<T>where
T: Sync + TransparentPtrType,
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more