pub struct FixedStr<const N: usize>(/* private fields */);Expand description
Stack-allocated, valid UTF-8 text with a fixed byte capacity.
Implementations§
Source§impl<const N: usize> FixedStr<N>
impl<const N: usize> FixedStr<N>
Sourcepub const fn remaining_capacity(&self) -> usize
pub const fn remaining_capacity(&self) -> usize
Returns the remaining UTF-8 byte capacity.
Sourcepub fn try_push_str(
&mut self,
value: &str,
) -> Result<Range<usize>, CapacityError>
pub fn try_push_str( &mut self, value: &str, ) -> Result<Range<usize>, CapacityError>
Appends text and returns its byte range.
Sourcepub fn try_push(&mut self, value: char) -> Result<Range<usize>, CapacityError>
pub fn try_push(&mut self, value: char) -> Result<Range<usize>, CapacityError>
Appends one Unicode scalar and returns its UTF-8 byte range.
Sourcepub fn truncate(&mut self, new_len: usize)
pub fn truncate(&mut self, new_len: usize)
Shortens the string to new_len UTF-8 bytes.
§Panics
Panics unless new_len is a character boundary within the string.
Sourcepub const fn into_bytes(self) -> FixedBytes<N>
pub const fn into_bytes(self) -> FixedBytes<N>
Converts the string into its fixed byte buffer.
Trait Implementations§
impl<const N: usize> Copy for FixedStr<N>
impl<const N: usize> Eq for FixedStr<N>
impl<const N: usize> StructuralPartialEq for FixedStr<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for FixedStr<N>
impl<const N: usize> RefUnwindSafe for FixedStr<N>
impl<const N: usize> Send for FixedStr<N>
impl<const N: usize> Sync for FixedStr<N>
impl<const N: usize> Unpin for FixedStr<N>
impl<const N: usize> UnsafeUnpin for FixedStr<N>
impl<const N: usize> UnwindSafe for FixedStr<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