pub struct SList { /* private fields */ }Implementations§
Source§impl SList
impl SList
pub fn new(max_length: i64) -> Self
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &SValue>
pub fn delete_all(&mut self)
pub fn length(&self) -> i64
pub fn textual_representation(&self) -> String
pub fn contains_item(&self, item: &SValue) -> bool
Sourcepub fn delete_nth<Q>(
&mut self,
one_based_n: &SValue,
sink: &mut Q,
) -> Option<SValue>
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_nreferred to a valid position, item removedNone:one_based_nwas invalid (0, too big, …), nothing changed
Sourcepub fn append_item(&mut self, item: SValue) -> Result<(), SListAlreadyFull>
pub fn append_item(&mut self, item: SValue) -> Result<(), SListAlreadyFull>
Appends an item to the end of the list
Sourcepub fn insert_item_at<Q>(
&mut self,
one_based_n: &SValue,
item: SValue,
sink: &mut Q,
) -> Result<bool, SListAlreadyFull>
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_nreferred to a valid position, item insertedfalse:one_based_nwas invalid (0, too big, …), nothing changed
Sourcepub fn replace_nth_item<Q>(
&mut self,
one_based_n: &SValue,
new_val: SValue,
sink: &mut Q,
) -> bool
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()]
pub fn nth_item<Q>(&self, one_based_n: &SValue, sink: &mut Q) -> SValue
pub fn first_index_of_item_in_list(&self, item: &SValue) -> i64
pub fn set_max_length( &mut self, max: i64, ) -> Result<(), ListLongerThanNewMaximum>
pub fn max_length(&self) -> i64
pub fn data(&self) -> &[SValue]
pub fn make_readonly(self) -> ReadonlySList
Trait Implementations§
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.
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
fn from_iter<T: IntoIterator<Item = C>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl IntoIterator for SList
impl IntoIterator for SList
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> 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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 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> ⓘ
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