Skip to main content

AsBytes

Trait AsBytes 

Source
pub trait AsBytes {
    // Required method
    fn as_bytes(&self) -> &[u8] ;
}
Expand description

A trait for types which represent a contiguous block of bytes, such as &[u8] or Vec<u8>.

Required Methods§

Source

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

Gets a slice of the entire block of bytes contained in this instance.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl AsBytes for Bytes

Available on crate feature bytes only.
Source§

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

Source§

impl AsBytes for BytesMut

Available on crate feature bytes only.
Source§

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

Source§

impl AsBytes for String

Source§

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

Source§

impl AsBytes for Vec<u8>

Source§

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

Source§

impl AsBytes for [u8]

Source§

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

Source§

impl AsBytes for str

Source§

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

Source§

impl<'cow, T: AsBytes + Clone + ?Sized> AsBytes for Cow<'cow, T>

Source§

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

Source§

impl<T: AsBytes + ?Sized> AsBytes for &T

Source§

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

Source§

impl<T: AsBytes + ?Sized> AsBytes for &mut T

Source§

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

Source§

impl<T: AsBytes + ?Sized> AsBytes for Arc<T>

Source§

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

Source§

impl<T: AsBytes + ?Sized> AsBytes for Box<T>

Source§

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

Source§

impl<T: AsBytes + ?Sized> AsBytes for Rc<T>

Source§

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

Source§

impl<const LEN: usize> AsBytes for [u8; LEN]

Source§

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

Implementors§