Skip to main content

ByteString

Trait ByteString 

Source
pub trait ByteString {
    type OutSlice: ?Sized + ByteStringSlice;

    // Required method
    unsafe fn as_mut_bytes(&mut self) -> &mut [u8] ;
}
Expand description

Trait representing types that can be in-place parsed (i.e. ASCII-compatible byte strings)

Required Associated Types§

Source

type OutSlice: ?Sized + ByteStringSlice

Output slice type (e.g str or OsStr)

Required Methods§

Source

unsafe fn as_mut_bytes(&mut self) -> &mut [u8]

Get the string as a mutable sequence of bytes

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ByteString for OsStr

Available on crate feature std only.
Source§

impl ByteString for String

Available on crate feature alloc only.
Source§

impl ByteString for [u8]

Parse a byte slice as a ASCII (or UTF-8/WTF-8/…) string, returning byte slices

Source§

impl ByteString for str

Parse a rust UTF-8 string, yeilding string slices

Implementors§