Struct multistr::Dynamic
[−]
[src]
pub struct Dynamic<T: StrLike + ?Sized> { /* fields omitted */ }
Vec of immutable strings stored on the heap in the same buffer.
Slicing ranges of the vector yields the strings in the range concatenated together.
Methods
impl<T: StrLike + ?Sized> Dynamic<T>
[src]
fn new() -> Dynamic<T>
Creates an empty Dynamic
.
fn with_capacities(num: usize, data: usize) -> Dynamic<T>
Creates an empty Dynamic
with the given capacities.
The Dynamic
will be able to hold exactly num
strings totallying up to data
in
length without reallocating. If num
and data
are zero, the vector will not
allocate.
fn num_capacity(&self) -> usize
Returns the number of strings this vector can hold without reallocating.
fn data_capacity(&self) -> usize
Returns the total length of strings this vector can hold without reallocating.
fn reserve(&mut self, additional: usize, bytes: usize)
Reserves capacity for at least additional
more strings totalling to bytes
more
bytes.
fn reserve_exact(&mut self, additional: usize, bytes: usize)
Similar to reserve
, calling reserve_exact
on the inner String
and Vec
.
fn shrink_to_fit(&mut self)
See: Vec::shrink_to_fit
.
fn truncate(&mut self, len: usize)
Shortens the buffer, keeping the first len
slices and dropping the rest.
fn append(&mut self, other: &mut Dynamic<T>)
Moves all of the elements of other
into self
, leaving other
empty.
fn len(&self) -> usize
Returns the number of strings in the vector.
fn is_empty(&self) -> bool
Returns true
iff the vector contains no elements.
fn split_off(&mut self, at: usize) -> Dynamic<T>
Splits the collection into two at the given index.
fn clear(&mut self)
Clears the vector, removing all strings.
fn push(&mut self, t: &T)
Adds a string to the end of the vec.
fn pop(&mut self) -> bool
Removes a string from the end of the vec and discards it.
fn pop_off(&mut self) -> Option<<T as ToOwned>::Owned>
Removes a string from the end of the vec and allocates it onto a new buffer.
fn iter(&self) -> Iter<T>
Returns an iterator over the strings in the vector.
Trait Implementations
impl<T: StrLike + ?Sized> Send for Dynamic<T> where
&'static T::Data: Send,
T::OwnedData: Send,
[src]
&'static T::Data: Send,
T::OwnedData: Send,
impl<T: StrLike + ?Sized> Sync for Dynamic<T> where
&'static T::Data: Sync,
T::OwnedData: Sync,
[src]
&'static T::Data: Sync,
T::OwnedData: Sync,
impl<T: StrLike + ?Sized> Default for Dynamic<T>
[src]
impl<'a, T: StrLike + ?Sized> FromIterator<&'a T> for Dynamic<T>
[src]
fn from_iter<I: IntoIterator<Item = &'a T>>(iter: I) -> Dynamic<T>
Creates a value from an iterator. Read more
impl<'a, T: StrLike + ?Sized> FromIterator<&'a &'a T> for Dynamic<T>
[src]
fn from_iter<I: IntoIterator<Item = &'a &'a T>>(iter: I) -> Dynamic<T>
Creates a value from an iterator. Read more
impl<'a, T: StrLike + ?Sized> Extend<&'a &'a T> for Dynamic<T>
[src]
fn extend<I: IntoIterator<Item = &'a &'a T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
impl<'a, T: StrLike + ?Sized> Extend<&'a T> for Dynamic<T>
[src]
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
impl<'a, T: StrLike + ?Sized> IntoIterator for &'a Dynamic<T>
[src]
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) -> Iter<'a, T>
Creates an iterator from a value. Read more
impl<T: ?Sized + StrLike> Index<usize> for Dynamic<T>
[src]
type Output = T
The returned type after indexing
fn index(&self, index: usize) -> &T
The method for the indexing (container[index]
) operation
impl<T: ?Sized + StrLike + StrLikeMut> IndexMut<usize> for Dynamic<T> where
T::Data: IndexRangesMut,
T::OwnedData: BorrowMut<T::Data>,
[src]
T::Data: IndexRangesMut,
T::OwnedData: BorrowMut<T::Data>,
fn index_mut(&mut self, index: usize) -> &mut T
The method for the mutable indexing (container[index]
) operation
impl<T: ?Sized + DataConcat> Index<Range<usize>> for Dynamic<T>
[src]
type Output = T
The returned type after indexing
fn index(&self, range: Range<usize>) -> &T
The method for the indexing (container[index]
) operation
impl<T: ?Sized + DataConcat> Index<RangeFrom<usize>> for Dynamic<T>
[src]
type Output = T
The returned type after indexing
fn index(&self, range: RangeFrom<usize>) -> &T
The method for the indexing (container[index]
) operation
impl<T: ?Sized + DataConcat> Index<RangeTo<usize>> for Dynamic<T>
[src]
type Output = T
The returned type after indexing
fn index(&self, range: RangeTo<usize>) -> &T
The method for the indexing (container[index]
) operation
impl<T: ?Sized + DataConcat> Index<RangeFull> for Dynamic<T>
[src]
type Output = T
The returned type after indexing
fn index(&self, _: RangeFull) -> &T
The method for the indexing (container[index]
) operation
impl<T: ?Sized + StrLike> Clone for Dynamic<T> where
Cow<'static, T::Data>: Clone,
[src]
Cow<'static, T::Data>: Clone,
fn clone(&self) -> Dynamic<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Dynamic<T>)
Performs copy-assignment from source
. Read more
impl<T: ?Sized + StrLike> Hash for Dynamic<T> where
T::Data: Hash,
[src]
T::Data: Hash,
fn hash<H: Hasher>(&self, state: &mut H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: ?Sized + StrLike + PartialEq> PartialEq for Dynamic<T>
[src]
fn eq(&self, rhs: &Dynamic<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<'a, T: ?Sized + StrLike + PartialEq> PartialEq<&'a [&'a T]> for Dynamic<T>
[src]
fn eq(&self, rhs: &&'a [&'a T]) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<'a, T: ?Sized + StrLike + PartialEq> PartialEq<Vec<&'a T>> for Dynamic<T>
[src]
fn eq(&self, rhs: &Vec<&'a T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<T: ?Sized + StrLike + Eq> Eq for Dynamic<T>
[src]
impl<T: ?Sized + StrLike + PartialOrd> PartialOrd for Dynamic<T>
[src]
fn partial_cmp(&self, rhs: &Dynamic<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a, T: ?Sized + StrLike + PartialOrd> PartialOrd<&'a [&'a T]> for Dynamic<T>
[src]
fn partial_cmp(&self, rhs: &&'a [&'a T]) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<'a, T: ?Sized + StrLike + PartialOrd> PartialOrd<Vec<&'a T>> for Dynamic<T>
[src]
fn partial_cmp(&self, rhs: &Vec<&'a T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: ?Sized + StrLike + Ord> Ord for Dynamic<T>
[src]
fn cmp(&self, rhs: &Dynamic<T>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<T: ?Sized + StrLike + Debug> Debug for Dynamic<T>
[src]
impl<T: ?Sized + StrLike> Arbitrary for Dynamic<T> where
T::Owned: Arbitrary,
Dynamic<T>: Send + Sync,
[src]
T::Owned: Arbitrary,
Dynamic<T>: Send + Sync,