pub struct Utf8Bytes(/* private fields */);Expand description
Wrapper around Bytes which is guaranteed to be UTF-8.
Like Bytes, it is cheaply cloneable and facilitates zero-copy.
Implementations§
Source§impl Utf8Bytes
impl Utf8Bytes
pub fn as_str(&self) -> &str
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn bytes(&self) -> &Bytes
pub fn into_inner(self) -> Bytes
Sourcepub fn split_off(&mut self, at: usize) -> Self
pub fn split_off(&mut self, at: usize) -> Self
Same as Bytes::split_off(), but panics if slicing doesn’t result in valid utf8.
Afterwards self contains elements [0, at), and the returned Utf8Bytes
contains elements [at, len).
Sourcepub fn split_to(&mut self, at: usize) -> Self
pub fn split_to(&mut self, at: usize) -> Self
Same as Bytes::split_to(), but panics if slicing doesn’t result in valid utf8.
Afterwards self contains elements [at, len), and the returned Utf8Bytes
contains elements [0, at).
Trait Implementations§
impl Eq for Utf8Bytes
impl StructuralPartialEq for Utf8Bytes
Auto Trait Implementations§
impl !Freeze for Utf8Bytes
impl RefUnwindSafe for Utf8Bytes
impl Send for Utf8Bytes
impl Sync for Utf8Bytes
impl Unpin for Utf8Bytes
impl UnwindSafe for Utf8Bytes
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