Skip to main content

SList

Struct SList 

Source
pub struct SList { /* private fields */ }

Implementations§

Source§

impl SList

Source

pub fn new(max_length: i64) -> Self

Source

pub fn iter(&self) -> impl DoubleEndedIterator<Item = &SValue>

Source

pub fn delete_all(&mut self)

Source

pub fn length(&self) -> i64

Source

pub fn textual_representation(&self) -> String

Source

pub fn contains_item(&self, item: &SValue) -> bool

Source

pub fn delete_nth<Q>( &mut self, one_based_n: &SValue, sink: &mut Q, ) -> Option<SValue>

Deletes the item at the position one_based_n if one_based_n can be converted into an integer in range [1; self.length()].

Returns the removed item if it was removed:

  • Some(item): one_based_n referred to a valid position, item removed
  • None: one_based_n was invalid (0, too big, …), nothing changed
Source

pub fn append_item(&mut self, item: SValue) -> Result<(), SListAlreadyFull>

Appends an item to the end of the list

Source

pub fn insert_item_at<Q>( &mut self, one_based_n: &SValue, item: SValue, sink: &mut Q, ) -> Result<bool, SListAlreadyFull>

Inserts the item at the position one_based_n if one_based_n can be converted into an integer in range [1; self.length() + 1].

One more than length will be identical to appending.

Returns if the list was changed (bool).

  • true: one_based_n referred to a valid position, item inserted
  • false: one_based_n was invalid (0, too big, …), nothing changed
Source

pub fn replace_nth_item<Q>( &mut self, one_based_n: &SValue, new_val: SValue, sink: &mut Q, ) -> bool

Replaces the n-th item with new_val if one_based_n can be converted into an integer in range [1; self.length()]

Source

pub fn nth_item<Q>(&self, one_based_n: &SValue, sink: &mut Q) -> SValue

Source

pub fn first_index_of_item_in_list(&self, item: &SValue) -> i64

Source

pub fn set_max_length( &mut self, max: i64, ) -> Result<(), ListLongerThanNewMaximum>

Source

pub fn max_length(&self) -> i64

Source

pub fn data(&self) -> &[SValue]

Source

pub fn make_readonly(self) -> ReadonlySList

Trait Implementations§

Source§

impl Clone for SList

Source§

fn clone(&self) -> SList

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SList

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C: Into<SValue>> FromIterator<C> for SList

Be careful that this will set the maximum length to the iterators length. If further insertions should be possible, reset the max length using Self::set_max_length afterwards.

Source§

fn from_iter<T: IntoIterator<Item = C>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl IntoIterator for SList

Source§

type Item = SValue

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<SValue>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for SList

Source§

fn eq(&self, other: &SList) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SList

Auto Trait Implementations§

§

impl !Send for SList

§

impl !Sync for SList

§

impl Freeze for SList

§

impl RefUnwindSafe for SList

§

impl Unpin for SList

§

impl UnsafeUnpin for SList

§

impl UnwindSafe for SList

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
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.

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
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
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.