pub struct FixStr<const N: usize> { /* private fields */ }Implementations§
Source§impl<const N: usize> FixStr<N>
impl<const N: usize> FixStr<N>
Sourcepub fn new(s: &str) -> Option<Self>
pub fn new(s: &str) -> Option<Self>
Creates a new FixStr if the input fits within capacity.
Returns None if the string is too long (> N octets) or exceeds u8::MAX.
Sourcepub fn new_unchecked(s: &str) -> Self
pub fn new_unchecked(s: &str) -> Self
Creates a new FixStr without capacity checking.
§Panics
Panics if the string is too long for the fixed capacity.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns a string slice containing the entire string.
§Safety
Safe because we only store valid UTF-8 strings.
Trait Implementations§
Source§impl<const N: usize> Ord for FixStr<N>
impl<const N: usize> Ord for FixStr<N>
Source§impl<const N: usize> PartialOrd for FixStr<N>
impl<const N: usize> PartialOrd for FixStr<N>
impl<const N: usize> Copy for FixStr<N>
impl<const N: usize> Eq for FixStr<N>
impl<const N: usize> StructuralPartialEq for FixStr<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for FixStr<N>
impl<const N: usize> RefUnwindSafe for FixStr<N>
impl<const N: usize> Send for FixStr<N>
impl<const N: usize> Sync for FixStr<N>
impl<const N: usize> Unpin for FixStr<N>
impl<const N: usize> UnwindSafe for FixStr<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