pub struct BoundedString<const N: usize>(/* private fields */);Expand description
Fixed-capacity UTF-8 string — bounded at compile time by const generic N.
Canonical wire = postcard::serialize_str (varint length + N-bounded
UTF-8 bytes). N is not on the wire — decode checks against the const.
Expanding N requires a SCHEMA_VERSION bump on the enclosing Component;
shrinking is forbidden (existing records might exceed the new cap).
Implementations§
Trait Implementations§
Source§impl<const N: usize> Clone for BoundedString<N>
impl<const N: usize> Clone for BoundedString<N>
Source§fn clone(&self) -> BoundedString<N>
fn clone(&self) -> BoundedString<N>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const N: usize> Debug for BoundedString<N>
impl<const N: usize> Debug for BoundedString<N>
Source§impl<'de, const N: usize> Deserialize<'de> for BoundedString<N>
impl<'de, const N: usize> Deserialize<'de> for BoundedString<N>
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl<const N: usize> Hash for BoundedString<N>
impl<const N: usize> Hash for BoundedString<N>
Source§impl<const N: usize> Ord for BoundedString<N>
impl<const N: usize> Ord for BoundedString<N>
Source§fn cmp(&self, other: &BoundedString<N>) -> Ordering
fn cmp(&self, other: &BoundedString<N>) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const N: usize> PartialEq for BoundedString<N>
impl<const N: usize> PartialEq for BoundedString<N>
Source§fn eq(&self, other: &BoundedString<N>) -> bool
fn eq(&self, other: &BoundedString<N>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<const N: usize> PartialOrd for BoundedString<N>
impl<const N: usize> PartialOrd for BoundedString<N>
Source§impl<const N: usize> Serialize for BoundedString<N>
impl<const N: usize> Serialize for BoundedString<N>
impl<const N: usize> Eq for BoundedString<N>
impl<const N: usize> StructuralPartialEq for BoundedString<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for BoundedString<N>
impl<const N: usize> RefUnwindSafe for BoundedString<N>
impl<const N: usize> Send for BoundedString<N>
impl<const N: usize> Sync for BoundedString<N>
impl<const N: usize> Unpin for BoundedString<N>
impl<const N: usize> UnsafeUnpin for BoundedString<N>
impl<const N: usize> UnwindSafe for BoundedString<N>
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