Struct glib::collections::list::List
source · pub struct List<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> List<T>
impl<T: TransparentPtrType> List<T>
sourcepub unsafe fn from_glib_none(list: *const GList) -> List<T>
pub unsafe fn from_glib_none(list: *const GList) -> List<T>
Create a new List
around a list.
sourcepub unsafe fn from_glib_container(list: *mut GList) -> List<T>
pub unsafe fn from_glib_container(list: *mut GList) -> List<T>
Create a new List
around a list.
sourcepub unsafe fn from_glib_full(list: *mut GList) -> List<T>
pub unsafe fn from_glib_full(list: *mut GList) -> List<T>
Create a new List
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 List
.
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 GList
pub fn as_mut_ptr(&mut self) -> *mut GList
Returns the underlying pointer.
Trait Implementations§
source§impl<T: TransparentPtrType> Clone for List<T>
impl<T: TransparentPtrType> Clone for List<T>
source§impl<T: TransparentPtrType> Default for List<T>
impl<T: TransparentPtrType> Default for List<T>
source§impl<T: TransparentPtrType> Drop for List<T>
impl<T: TransparentPtrType> Drop for List<T>
source§impl<T: TransparentPtrType> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *const GList> for List<T>
impl<T: TransparentPtrType> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *const GList> for List<T>
source§impl<T: TransparentPtrType> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *mut GList> for List<T>
impl<T: TransparentPtrType> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *mut GList> for List<T>
source§impl<T: TransparentPtrType> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *const GList> for List<T>
impl<T: TransparentPtrType> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *const GList> for List<T>
source§unsafe fn from_glib_none(ptr: *const GList) -> Self
unsafe fn from_glib_none(ptr: *const GList) -> Self
source§unsafe fn from_glib_container(_ptr: *const GList) -> Self
unsafe fn from_glib_container(_ptr: *const GList) -> Self
source§unsafe fn from_glib_full(_ptr: *const GList) -> Self
unsafe fn from_glib_full(_ptr: *const GList) -> Self
source§impl<T: TransparentPtrType> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *mut GList> for List<T>
impl<T: TransparentPtrType> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *mut GList> for List<T>
source§unsafe fn from_glib_none(ptr: *mut GList) -> Self
unsafe fn from_glib_none(ptr: *mut GList) -> Self
source§unsafe fn from_glib_container(ptr: *mut GList) -> Self
unsafe fn from_glib_container(ptr: *mut GList) -> Self
source§unsafe fn from_glib_full(ptr: *mut GList) -> Self
unsafe fn from_glib_full(ptr: *mut GList) -> Self
source§impl<T: TransparentPtrType> FromIterator<T> for List<T>
impl<T: TransparentPtrType> FromIterator<T> for List<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 GList> for List<T>
impl<T: TransparentPtrType> IntoGlibPtr<*mut GList> for List<T>
source§unsafe fn into_glib_ptr(self) -> *mut GList
unsafe fn into_glib_ptr(self) -> *mut GList
source§impl<'a, T: TransparentPtrType> IntoIterator for &'a List<T>
impl<'a, T: TransparentPtrType> IntoIterator for &'a List<T>
source§impl<'a, T: TransparentPtrType> IntoIterator for &'a mut List<T>
impl<'a, T: TransparentPtrType> IntoIterator for &'a mut List<T>
source§impl<T: TransparentPtrType> IntoIterator for List<T>
impl<T: TransparentPtrType> IntoIterator for List<T>
source§impl<'a, T: TransparentPtrType + 'a> ToGlibPtr<'a, *const GList> for List<T>
impl<'a, T: TransparentPtrType + 'a> ToGlibPtr<'a, *const GList> for List<T>
type Storage = PhantomData<&'a List<T>>
source§fn to_glib_container(&'a self) -> Stash<'a, P, Self>
fn to_glib_container(&'a self) -> Stash<'a, P, Self>
source§fn to_glib_full(&self) -> P
fn to_glib_full(&self) -> P
source§impl<'a, T: TransparentPtrType + 'a> ToGlibPtrMut<'a, *mut GList> for List<T>
impl<'a, T: TransparentPtrType + 'a> ToGlibPtrMut<'a, *mut GList> for List<T>
impl<T: Send + TransparentPtrType> Send for List<T>
impl<T: Sync + TransparentPtrType> Sync for List<T>
Auto Trait Implementations§
impl<T> Freeze for List<T>
impl<T> RefUnwindSafe for List<T>where
T: RefUnwindSafe,
impl<T> Unpin for List<T>where
T: Unpin,
impl<T> UnwindSafe for List<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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)