MutableStringSequence

Struct MutableStringSequence 

Source
pub struct MutableStringSequence { /* private fields */ }
Expand description

A sequence of strings. This is used to represent a path.

Implementations§

Source§

impl MutableStringSequence

Source

pub fn iter(&self) -> StringSequenceIter<'_>

Source

pub fn slice(&self, range: impl ToRange) -> StringSequenceIter<'_>

Source

pub fn get(&self, index: usize) -> Option<&str>

Source

pub fn text(&self) -> &str

Source

pub fn first(&self) -> Option<&str>

Source

pub fn last(&self) -> Option<&str>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn starts_with(&self, other: &[impl AsRef<str>]) -> bool

Source

pub fn ends_with(&self, other: &[impl AsRef<str>]) -> bool

Source

pub fn contains(&self, other: &[impl AsRef<str>]) -> bool

Source§

impl MutableStringSequence

Source

pub fn new() -> Self

Create a new empty sequence.

Source

pub fn with_capacity(num_tokens: usize, num_chars: usize) -> Self

Create new instance with capacities

Source

pub fn token_capacity(&self) -> usize

Token array capacity

Source

pub fn text_capacity(&self) -> usize

Text buffer capacity

Source

pub fn reserve_buffer(&mut self, num_chars: usize)

Reserve space for internal string container.

NOTE: Consider delimiter length when reserving space.

Source

pub fn reserve_index(&mut self, num_tokens: usize)

Reserve space for internal index container. Index container indicates the number of tokens that can be appended without reallocation.

Source

pub fn extend_from_slice<T: AsRef<str>>(&mut self, slice: &[T])

Add list of references to the internal buffer.

Source

pub fn extend<T: AsRef<str>>(&mut self, into_iter: impl IntoIterator<Item = T>)

Append a string to the internal buffer. As we can’t pre-calculate required space for text buffer, this is inherently inefficient compared to Self::extend_from_slice.

Source

pub fn remove(&mut self, index: usize)

Remove the string at the specified index.

§Panics

Panics if the index is out of bounds.

Source

pub fn pop_back(&mut self)

Remove the last string quickly.

Source

pub fn push_back(&mut self, value: impl AsRef<str>)

Append a string to the end of the sequence.

Source

pub fn insert(&mut self, index: usize, value: impl AsRef<str>)

Insert a string at the specified index.

Source

pub fn clear(&mut self)

Source

pub fn drain(&mut self, range: impl ToRange) -> Drain<'_>

Source

pub fn into_string_sequence(self) -> StringSequence

Source§

impl MutableStringSequence

Source

pub fn from_slice(slice: &[impl AsRef<str>]) -> Self

Trait Implementations§

Source§

impl AsRef<[u8]> for MutableStringSequence

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<OsStr> for MutableStringSequence

Source§

fn as_ref(&self) -> &OsStr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<Path> for MutableStringSequence

Source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<str> for MutableStringSequence

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for MutableStringSequence

Source§

fn clone(&self) -> MutableStringSequence

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

impl Debug for MutableStringSequence

Source§

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

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

impl Default for MutableStringSequence

Source§

fn default() -> MutableStringSequence

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

impl Display for MutableStringSequence

Source§

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

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

impl<'a, T: StringSequenceView> From<&'a T> for MutableStringSequence

Source§

fn from(value: &'a T) -> Self

Converts to this type from the input type.
Source§

impl From<MutableStringSequence> for SharedStringSequence

Source§

fn from(value: MutableStringSequence) -> Self

Converts to this type from the input type.
Source§

impl From<MutableStringSequence> for String

Source§

fn from(value: MutableStringSequence) -> Self

Converts to this type from the input type.
Source§

impl From<MutableStringSequence> for StringSequence

Source§

fn from(value: MutableStringSequence) -> Self

Converts to this type from the input type.
Source§

impl From<SharedStringSequence> for MutableStringSequence

Source§

fn from(value: SharedStringSequence) -> Self

Converts to this type from the input type.
Source§

impl From<String> for MutableStringSequence

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl From<StringSequence> for MutableStringSequence

Source§

fn from(value: StringSequence) -> Self

Converts to this type from the input type.
Source§

impl<T: AsRef<str>> FromIterator<T> for MutableStringSequence

Source§

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

Creates a value from an iterator. Read more
Source§

impl Hash for MutableStringSequence

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<usize> for MutableStringSequence

Source§

type Output = str

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a> IntoIterator for &'a MutableStringSequence

Source§

type Item = &'a str

The type of the elements being iterated over.
Source§

type IntoIter = StringSequenceIter<'a>

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 Ord for MutableStringSequence

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: StringSequenceView> PartialEq<T> for MutableStringSequence

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: StringSequenceView> PartialOrd<T> for MutableStringSequence

Source§

fn partial_cmp(&self, other: &T) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for MutableStringSequence

Auto Trait Implementations§

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.