pub struct ArrayStr<const N: usize> { /* private fields */ }
Expand description
A utf-8 byte array
§Example
use const_base::ArrayStr;
static ARR_STR: ArrayStr<12> = ArrayStr::from_utf8_unwrap(*b"hello world!");
assert_eq!(ARR_STR.as_str(), "hello world!");
assert_eq!(ARR_STR, "hello world!");
Implementations§
Source§impl<const N: usize> ArrayStr<N>
impl<const N: usize> ArrayStr<N>
Sourcepub const fn from_utf8(arr: [u8; N]) -> Result<Self, Utf8Error>
pub const fn from_utf8(arr: [u8; N]) -> Result<Self, Utf8Error>
Constructs an ArrayStr
, returning an error if arr
isn’t valid utf-8.
Sourcepub const fn from_utf8_unwrap(arr: [u8; N]) -> Self
pub const fn from_utf8_unwrap(arr: [u8; N]) -> Self
Sourcepub const unsafe fn from_utf8_unchecked(arr: [u8; N]) -> Self
pub const unsafe fn from_utf8_unchecked(arr: [u8; N]) -> Self
Sourcepub const fn into_array(self) -> [u8; N]
pub const fn into_array(self) -> [u8; N]
Unwraps this into the wrapped byte array.
Trait Implementations§
impl<const N: usize> Copy for ArrayStr<N>
impl<const N: usize> Eq for ArrayStr<N>
impl<const N: usize> StructuralPartialEq for ArrayStr<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for ArrayStr<N>
impl<const N: usize> RefUnwindSafe for ArrayStr<N>
impl<const N: usize> Send for ArrayStr<N>
impl<const N: usize> Sync for ArrayStr<N>
impl<const N: usize> Unpin for ArrayStr<N>
impl<const N: usize> UnwindSafe for ArrayStr<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