Type Alias amplify::confinement::SmallString
source · pub type SmallString = Confined<String, ZERO, U16>;
Expand description
String
with maximum 2^16-1 characters.
Aliased Type§
struct SmallString(/* private fields */);
Implementations§
source§impl<'c, C, const MIN_LEN: usize, const MAX_LEN: usize> Confined<C, MIN_LEN, MAX_LEN>where
C: Collection + 'c,
&'c mut C: IntoIterator<Item = &'c mut <C as Collection>::Item>,
impl<'c, C, const MIN_LEN: usize, const MAX_LEN: usize> Confined<C, MIN_LEN, MAX_LEN>where C: Collection + 'c, &'c mut C: IntoIterator<Item = &'c mut <C as Collection>::Item>,
sourcepub fn iter_mut(&'c mut self) -> <&'c mut C as IntoIterator>::IntoIter
pub fn iter_mut(&'c mut self) -> <&'c mut C as IntoIterator>::IntoIter
Returns an iterator that allows modifying each value.
The iterator yields all items from start to end.
source§impl<'c, C, const MIN_LEN: usize, const MAX_LEN: usize> Confined<C, MIN_LEN, MAX_LEN>where
C: KeyedCollection + 'c,
&'c mut C: IntoIterator<Item = (&'c <C as KeyedCollection>::Key, &'c mut <C as KeyedCollection>::Value)>,
impl<'c, C, const MIN_LEN: usize, const MAX_LEN: usize> Confined<C, MIN_LEN, MAX_LEN>where C: KeyedCollection + 'c, &'c mut C: IntoIterator<Item = (&'c <C as KeyedCollection>::Key, &'c mut <C as KeyedCollection>::Value)>,
sourcepub fn keyed_values_mut(&'c mut self) -> <&'c mut C as IntoIterator>::IntoIter
pub fn keyed_values_mut(&'c mut self) -> <&'c mut C as IntoIterator>::IntoIter
Returns an iterator that allows modifying each value for each key.
source§impl<C: Collection, const MIN_LEN: usize, const MAX_LEN: usize> Confined<C, MIN_LEN, MAX_LEN>
impl<C: Collection, const MIN_LEN: usize, const MAX_LEN: usize> Confined<C, MIN_LEN, MAX_LEN>
sourcepub fn try_from(col: C) -> Result<Self, Error>
pub fn try_from(col: C) -> Result<Self, Error>
Tries to construct a confinement over a collection. Fails if the number of items in the collection exceeds one of the confinement bounds.
sourcepub fn try_from_iter<I: IntoIterator<Item = C::Item>>(
iter: I
) -> Result<Self, Error>
pub fn try_from_iter<I: IntoIterator<Item = C::Item>>( iter: I ) -> Result<Self, Error>
Tries to construct a confinement with a collection of elements taken from an iterator. Fails if the number of items in the collection exceeds one of the confinement bounds.
sourcepub fn into_inner(self) -> C
pub fn into_inner(self) -> C
Decomposes into the inner collection type
sourcepub fn push(&mut self, elem: C::Item) -> Result<(), Error>
pub fn push(&mut self, elem: C::Item) -> Result<(), Error>
Attempts to add a single element to the confined collection. Fails if the number of elements in the collection already maximal.
source§impl<C, const MAX_LEN: usize> Confined<C, ZERO, MAX_LEN>where
C: Default + Collection,
impl<C, const MAX_LEN: usize> Confined<C, ZERO, MAX_LEN>where C: Default + Collection,
sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Constructs a new confinement containing no elements, but with a
pre-allocated storage for the capacity
of elements.
source§impl<C: KeyedCollection, const MIN_LEN: usize, const MAX_LEN: usize> Confined<C, MIN_LEN, MAX_LEN>
impl<C: KeyedCollection, const MIN_LEN: usize, const MAX_LEN: usize> Confined<C, MIN_LEN, MAX_LEN>
source§impl<C, const MAX_LEN: usize> Confined<C, ONE, MAX_LEN>where
C: Default + KeyedCollection,
impl<C, const MAX_LEN: usize> Confined<C, ONE, MAX_LEN>where C: Default + KeyedCollection,
sourcepub fn with_key_value(key: C::Key, value: C::Value) -> Self
pub fn with_key_value(key: C::Key, value: C::Value) -> Self
Constructs a confinement with a collection made of a single required key-value pair.
Trait Implementations§
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> AsMut<[<C as Collection>::Item]> for Confined<C, MIN_LEN, MAX_LEN>where
C: Collection + AsMut<[C::Item]>,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> AsMut<[<C as Collection>::Item]> for Confined<C, MIN_LEN, MAX_LEN>where C: Collection + AsMut<[C::Item]>,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> AsRef<[<C as Collection>::Item]> for Confined<C, MIN_LEN, MAX_LEN>where
C: Collection + AsRef<[C::Item]>,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> AsRef<[<C as Collection>::Item]> for Confined<C, MIN_LEN, MAX_LEN>where C: Collection + AsRef<[C::Item]>,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Borrow<[<C as Collection>::Item]> for Confined<C, MIN_LEN, MAX_LEN>where
C: Collection + Borrow<[C::Item]>,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Borrow<[<C as Collection>::Item]> for Confined<C, MIN_LEN, MAX_LEN>where C: Collection + Borrow<[C::Item]>,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> BorrowMut<[<C as Collection>::Item]> for Confined<C, MIN_LEN, MAX_LEN>where
C: Collection + BorrowMut<[C::Item]>,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> BorrowMut<[<C as Collection>::Item]> for Confined<C, MIN_LEN, MAX_LEN>where C: Collection + BorrowMut<[C::Item]>,
source§fn borrow_mut(&mut self) -> &mut [C::Item]
fn borrow_mut(&mut self) -> &mut [C::Item]
source§impl<C: Clone + Collection, const MIN_LEN: usize, const MAX_LEN: usize> Clone for Confined<C, MIN_LEN, MAX_LEN>
impl<C: Clone + Collection, const MIN_LEN: usize, const MAX_LEN: usize> Clone for Confined<C, MIN_LEN, MAX_LEN>
source§impl<C: Debug + Collection, const MIN_LEN: usize, const MAX_LEN: usize> Debug for Confined<C, MIN_LEN, MAX_LEN>
impl<C: Debug + Collection, const MIN_LEN: usize, const MAX_LEN: usize> Debug for Confined<C, MIN_LEN, MAX_LEN>
source§impl<C, const MAX_LEN: usize> Default for Confined<C, ZERO, MAX_LEN>where
C: Default + Collection,
impl<C, const MAX_LEN: usize> Default for Confined<C, ZERO, MAX_LEN>where C: Default + Collection,
source§impl<C: Collection, const MIN_LEN: usize, const MAX_LEN: usize> Deref for Confined<C, MIN_LEN, MAX_LEN>
impl<C: Collection, const MIN_LEN: usize, const MAX_LEN: usize> Deref for Confined<C, MIN_LEN, MAX_LEN>
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Display for Confined<C, MIN_LEN, MAX_LEN>where
C: Display + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Display for Confined<C, MIN_LEN, MAX_LEN>where C: Display + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> FromStr for Confined<C, MIN_LEN, MAX_LEN>where
C: FromStr + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> FromStr for Confined<C, MIN_LEN, MAX_LEN>where C: FromStr + Collection,
source§impl<C: Hash + Collection, const MIN_LEN: usize, const MAX_LEN: usize> Hash for Confined<C, MIN_LEN, MAX_LEN>
impl<C: Hash + Collection, const MIN_LEN: usize, const MAX_LEN: usize> Hash for Confined<C, MIN_LEN, MAX_LEN>
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<Range<usize>> for Confined<C, MIN_LEN, MAX_LEN>where
C: Index<Range<usize>, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<Range<usize>> for Confined<C, MIN_LEN, MAX_LEN>where C: Index<Range<usize>, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<RangeFrom<usize>> for Confined<C, MIN_LEN, MAX_LEN>where
C: Index<RangeFrom<usize>, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<RangeFrom<usize>> for Confined<C, MIN_LEN, MAX_LEN>where C: Index<RangeFrom<usize>, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<RangeFull> for Confined<C, MIN_LEN, MAX_LEN>where
C: Index<RangeFull, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<RangeFull> for Confined<C, MIN_LEN, MAX_LEN>where C: Index<RangeFull, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<RangeInclusive<usize>> for Confined<C, MIN_LEN, MAX_LEN>where
C: Index<RangeInclusive<usize>, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<RangeInclusive<usize>> for Confined<C, MIN_LEN, MAX_LEN>where C: Index<RangeInclusive<usize>, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<RangeTo<usize>> for Confined<C, MIN_LEN, MAX_LEN>where
C: Index<RangeTo<usize>, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<RangeTo<usize>> for Confined<C, MIN_LEN, MAX_LEN>where C: Index<RangeTo<usize>, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<RangeToInclusive<usize>> for Confined<C, MIN_LEN, MAX_LEN>where
C: Index<RangeToInclusive<usize>, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<RangeToInclusive<usize>> for Confined<C, MIN_LEN, MAX_LEN>where C: Index<RangeToInclusive<usize>, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<usize> for Confined<C, MIN_LEN, MAX_LEN>where
C: Index<usize, Output = C::Item> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> Index<usize> for Confined<C, MIN_LEN, MAX_LEN>where C: Index<usize, Output = C::Item> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<Range<usize>> for Confined<C, MIN_LEN, MAX_LEN>where
C: IndexMut<Range<usize>, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<Range<usize>> for Confined<C, MIN_LEN, MAX_LEN>where C: IndexMut<Range<usize>, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<RangeFrom<usize>> for Confined<C, MIN_LEN, MAX_LEN>where
C: IndexMut<RangeFrom<usize>, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<RangeFrom<usize>> for Confined<C, MIN_LEN, MAX_LEN>where C: IndexMut<RangeFrom<usize>, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<RangeFull> for Confined<C, MIN_LEN, MAX_LEN>where
C: IndexMut<RangeFull, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<RangeFull> for Confined<C, MIN_LEN, MAX_LEN>where C: IndexMut<RangeFull, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<RangeInclusive<usize>> for Confined<C, MIN_LEN, MAX_LEN>where
C: IndexMut<RangeInclusive<usize>, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<RangeInclusive<usize>> for Confined<C, MIN_LEN, MAX_LEN>where C: IndexMut<RangeInclusive<usize>, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<RangeTo<usize>> for Confined<C, MIN_LEN, MAX_LEN>where
C: IndexMut<RangeTo<usize>, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<RangeTo<usize>> for Confined<C, MIN_LEN, MAX_LEN>where C: IndexMut<RangeTo<usize>, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<RangeToInclusive<usize>> for Confined<C, MIN_LEN, MAX_LEN>where
C: IndexMut<RangeToInclusive<usize>, Output = [C::Item]> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<RangeToInclusive<usize>> for Confined<C, MIN_LEN, MAX_LEN>where C: IndexMut<RangeToInclusive<usize>, Output = [C::Item]> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<usize> for Confined<C, MIN_LEN, MAX_LEN>where
C: IndexMut<usize, Output = C::Item> + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IndexMut<usize> for Confined<C, MIN_LEN, MAX_LEN>where C: IndexMut<usize, Output = C::Item> + Collection,
source§impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IntoIterator for Confined<C, MIN_LEN, MAX_LEN>where
C: IntoIterator + Collection,
impl<C, const MIN_LEN: usize, const MAX_LEN: usize> IntoIterator for Confined<C, MIN_LEN, MAX_LEN>where C: IntoIterator + Collection,
source§impl<C: Ord + Collection, const MIN_LEN: usize, const MAX_LEN: usize> Ord for Confined<C, MIN_LEN, MAX_LEN>
impl<C: Ord + Collection, const MIN_LEN: usize, const MAX_LEN: usize> Ord for Confined<C, MIN_LEN, MAX_LEN>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<C: PartialEq + Collection, const MIN_LEN: usize, const MAX_LEN: usize> PartialEq<Confined<C, MIN_LEN, MAX_LEN>> for Confined<C, MIN_LEN, MAX_LEN>
impl<C: PartialEq + Collection, const MIN_LEN: usize, const MAX_LEN: usize> PartialEq<Confined<C, MIN_LEN, MAX_LEN>> for Confined<C, MIN_LEN, MAX_LEN>
source§impl<C: PartialOrd + Collection, const MIN_LEN: usize, const MAX_LEN: usize> PartialOrd<Confined<C, MIN_LEN, MAX_LEN>> for Confined<C, MIN_LEN, MAX_LEN>
impl<C: PartialOrd + Collection, const MIN_LEN: usize, const MAX_LEN: usize> PartialOrd<Confined<C, MIN_LEN, MAX_LEN>> for Confined<C, MIN_LEN, MAX_LEN>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more