Skip to main content

Bytes

Trait Bytes 

Source
pub trait Bytes {
    // Required methods
    fn as_slice(&self) -> &[u8] ;
    fn len(&self) -> usize;
    fn is_empty(&self) -> bool;
}
Expand description

Arbitrary-length array of bytes.

Required Methods§

Source

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

Returns a slice of the underlying bytes.

Source

fn len(&self) -> usize

Shorthand to retrieve the underlying length of the byte array.

Source

fn is_empty(&self) -> bool

Returns true if the array is empty.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Bytes for &[u8]

Source§

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

Source§

fn len(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

impl Bytes for &mut [u8]

Source§

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

Source§

fn len(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

impl Bytes for Vec<u8>

Source§

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

Source§

fn len(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

impl Bytes for [u8]

Source§

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

Source§

fn len(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

impl<const LENGTH: usize> Bytes for &[u8; LENGTH]

Source§

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

Source§

fn len(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

impl<const LENGTH: usize> Bytes for [u8; LENGTH]

Source§

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

Source§

fn len(&self) -> usize

Source§

fn is_empty(&self) -> bool

Implementors§

Source§

impl Bytes for HeapBytes

Available on crate feature protected only.
Source§

impl<A: Zeroize + Bytes, LM: LockMode> Bytes for Protected<A, ReadOnly, LM>

Available on crate feature protected only.
Source§

impl<A: Zeroize + Bytes, LM: LockMode> Bytes for Protected<A, ReadWrite, LM>

Available on crate feature protected only.
Source§

impl<InnerKey: ByteArray<CRYPTO_BOX_BEFORENMBYTES> + Bytes + Zeroize> Bytes for PrecalcSecretKey<InnerKey>

Source§

impl<const LENGTH: usize> Bytes for HeapByteArray<LENGTH>

Available on crate feature protected only.
Source§

impl<const LENGTH: usize> Bytes for StackByteArray<LENGTH>