#[repr(transparent)]pub struct FixedString<const N: usize>(pub [u8; N]);Expand description
A fixed-capacity string stored as a zero-padded UTF-8 byte array.
N is the maximum number of bytes (not characters). Strings shorter than
N are zero-padded. Strings longer than N are truncated at the last
valid UTF-8 character boundary that fits.
This type is Copy, #[repr(transparent)], and safe to embed in
#[repr(C)] shared memory structs.
Tuple Fields§
§0: [u8; N]Implementations§
Source§impl<const N: usize> FixedString<N>
impl<const N: usize> FixedString<N>
Sourcepub fn set(&mut self, s: &str)
pub fn set(&mut self, s: &str)
Set the string content, truncating at the last UTF-8 boundary that fits.
Trait Implementations§
Source§impl<const N: usize> Clone for FixedString<N>
impl<const N: usize> Clone for FixedString<N>
Source§fn clone(&self) -> FixedString<N>
fn clone(&self) -> FixedString<N>
Returns a duplicate of the value. Read more
1.0.0 · 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 FixedString<N>
impl<const N: usize> Debug for FixedString<N>
Source§impl<const N: usize> Default for FixedString<N>
impl<const N: usize> Default for FixedString<N>
Source§impl<'de, const N: usize> Deserialize<'de> for FixedString<N>
impl<'de, const N: usize> Deserialize<'de> for FixedString<N>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl<const N: usize> Display for FixedString<N>
impl<const N: usize> Display for FixedString<N>
Source§impl<const N: usize> Hash for FixedString<N>
impl<const N: usize> Hash for FixedString<N>
Source§impl<const N: usize> PartialEq for FixedString<N>
impl<const N: usize> PartialEq for FixedString<N>
Source§impl<const N: usize> Serialize for FixedString<N>
impl<const N: usize> Serialize for FixedString<N>
impl<const N: usize> Copy for FixedString<N>
impl<const N: usize> Eq for FixedString<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for FixedString<N>
impl<const N: usize> RefUnwindSafe for FixedString<N>
impl<const N: usize> Send for FixedString<N>
impl<const N: usize> Sync for FixedString<N>
impl<const N: usize> Unpin for FixedString<N>
impl<const N: usize> UnsafeUnpin for FixedString<N>
impl<const N: usize> UnwindSafe for FixedString<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.