Struct SList

pub struct SList<T>{ /* 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>

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>

Create a new SList around a list.

pub unsafe fn from_glib_full(list: *mut GSList) -> SList<T>

Create a new SList around a list.

pub fn new() -> SList<T>

Creates a new empty list.

pub fn iter(&self) -> Iter<'_, T>

Create a non-destructive iterator over the SList.

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Create a non-destructive mutable iterator over the SList.

pub fn is_empty(&self) -> bool

Check if the list is empty.

This operation is O(1).

pub fn len(&self) -> usize

Returns the length of the list.

This operation is O(n).

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>

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>

Removes the front item from the list, if any.

This operation is O(1).

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>

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>

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>

Removes the back item from the list, if any.

This operation is O(n).

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)

Reverse the list.

This operation is O(n).

pub fn sort(&mut self)
where T: Ord,

Sorts the list.

This operation is O(n * log n).

pub fn sort_by<F>(&mut self, f: F)
where F: FnMut(&T, &T) -> Ordering,

Sorts the list.

This operation is O(n * log n).

pub fn clear(&mut self)

Removes all items from the list.

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_ptr(&self) -> *const GSList

Returns the underlying pointer.

pub fn as_mut_ptr(&mut self) -> *mut GSList

Returns the underlying pointer.

pub fn into_raw(self) -> *mut GSList

Consumes the list and returns the underlying pointer.

Trait Implementations§

§

impl<T> Clone for SList<T>

§

fn clone(&self) -> SList<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Default for SList<T>

§

fn default() -> SList<T>

Returns the “default value” for a type. Read more
§

impl<T> Drop for SList<T>

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<T> Extend<T> for SList<T>

§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = T>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
§

impl<T> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *const GSList> for SList<T>

§

unsafe fn from_glib_none_num(ptr: *const GSList, _num: usize) -> SList<T>

Transfer: none. Read more
§

unsafe fn from_glib_container_num(_ptr: *const GSList, _num: usize) -> SList<T>

Transfer: container. Read more
§

unsafe fn from_glib_full_num(_ptr: *const GSList, _num: usize) -> SList<T>

Transfer: full. Read more
§

impl<T> FromGlibContainer<<T as GlibPtrDefault>::GlibType, *mut GSList> for SList<T>

§

unsafe fn from_glib_none_num(ptr: *mut GSList, _num: usize) -> SList<T>

Transfer: none. Read more
§

unsafe fn from_glib_container_num(ptr: *mut GSList, _num: usize) -> SList<T>

Transfer: container. Read more
§

unsafe fn from_glib_full_num(ptr: *mut GSList, _num: usize) -> SList<T>

Transfer: full. Read more
§

impl<T> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *const GSList> for SList<T>

§

unsafe fn from_glib_none(ptr: *const GSList) -> SList<T>

Transfer: none.
§

unsafe fn from_glib_container(_ptr: *const GSList) -> SList<T>

Transfer: container.
§

unsafe fn from_glib_full(_ptr: *const GSList) -> SList<T>

Transfer: full.
§

impl<T> FromGlibPtrContainer<<T as GlibPtrDefault>::GlibType, *mut GSList> for SList<T>

§

unsafe fn from_glib_none(ptr: *mut GSList) -> SList<T>

Transfer: none.
§

unsafe fn from_glib_container(ptr: *mut GSList) -> SList<T>

Transfer: container.
§

unsafe fn from_glib_full(ptr: *mut GSList) -> SList<T>

Transfer: full.
§

impl<T> FromIterator<T> for SList<T>

§

fn from_iter<I>(iter: I) -> SList<T>
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
§

impl<T> IntoGlibPtr<*mut GSList> for SList<T>

§

fn into_glib_ptr(self) -> *mut GSList

Transfer: full.
§

impl<'a, T> IntoIterator for &'a SList<T>

§

type Item = &'a T

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> <&'a SList<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
§

impl<'a, T> IntoIterator for &'a mut SList<T>

§

type Item = &'a mut T

The type of the elements being iterated over.
§

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> <&'a mut SList<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
§

impl<T> IntoIterator for SList<T>

§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> <SList<T> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
§

impl<'a, T> ToGlibPtr<'a, *const GSList> for SList<T>
where T: TransparentPtrType + 'a,

§

type Storage = PhantomData<&'a SList<T>>

§

fn to_glib_none(&'a self) -> Stash<'a, *const GSList, SList<T>>

Transfer: none. Read more
§

fn to_glib_container(&'a self) -> Stash<'a, P, Self>

Transfer: container. Read more
§

fn to_glib_full(&self) -> P

Transfer: full. Read more
§

impl<'a, T> ToGlibPtr<'a, *mut GSList> for SList<T>
where T: TransparentPtrType + 'a,

§

type Storage = PhantomData<&'a SList<T>>

§

fn to_glib_none(&'a self) -> Stash<'a, *mut GSList, SList<T>>

Transfer: none. Read more
§

fn to_glib_container(&'a self) -> Stash<'a, *mut GSList, SList<T>>

Transfer: container. Read more
§

fn to_glib_full(&self) -> *mut GSList

Transfer: full. Read more
§

impl<'a, T> ToGlibPtrMut<'a, *mut GSList> for SList<T>
where T: TransparentPtrType + 'a,

§

type Storage = PhantomData<&'a mut SList<T>>

§

fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut GSList, SList<T>>

Transfer: none. Read more
§

impl<T> Send for SList<T>

§

impl<T> 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<C> AsyncPosition<()> for C

§

fn position(_index: usize)

Returns the position. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<C, I> Position<(), I> for C

§

fn position(&self, _index: &I)

Returns the position. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TransparentType for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,