Trait xml5ever::tendril::fmt::Slice

source ·
pub unsafe trait Slice {
    // Required methods
    fn as_bytes(&self) -> &[u8] ;
    unsafe fn from_bytes(x: &[u8]) -> &Self;
    unsafe fn from_mut_bytes(x: &mut [u8]) -> &mut Self;
}
Expand description

Indicates a Rust slice type that is represented in memory as bytes.

Required Methods§

source

fn as_bytes(&self) -> &[u8]

Access the raw bytes of the slice.

source

unsafe fn from_bytes(x: &[u8]) -> &Self

Convert a byte slice to this kind of slice.

You may assume the buffer is already validated for Format.

source

unsafe fn from_mut_bytes(x: &mut [u8]) -> &mut Self

Convert a byte slice to this kind of slice.

You may assume the buffer is already validated for Format.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Slice for str

source§

fn as_bytes(&self) -> &[u8]

source§

unsafe fn from_bytes(x: &[u8]) -> &str

source§

unsafe fn from_mut_bytes(x: &mut [u8]) -> &mut str

source§

impl Slice for [u8]

source§

fn as_bytes(&self) -> &[u8]

source§

unsafe fn from_bytes(x: &[u8]) -> &[u8]

source§

unsafe fn from_mut_bytes(x: &mut [u8]) -> &mut [u8]

Implementors§