Trait StableBuf

Source
pub unsafe trait StableBuf:
    Unpin
    + Send
    + 'static {
    // Required methods
    fn stable_ptr(&self) -> *const u8;
    fn len(&self) -> usize;

    // Provided method
    fn as_ref(&self) -> &[u8]  { ... }
}
Expand description

A buffer with a stable memory address.

§Safety

The implementor must guarantee that the pointer remains valid and unchanged while the buffer is being used.

Required Methods§

Source

fn stable_ptr(&self) -> *const u8

Returns a raw pointer to this buffer.

Source

fn len(&self) -> usize

Length of the buffer.

Provided Methods§

Source

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

Returns the buffer as a slice.

Implementations on Foreign Types§

Source§

impl StableBuf for &'static str

Source§

impl StableBuf for &'static [u8]

Source§

impl StableBuf for Vec<u8>

Source§

impl StableBuf for Bytes

Source§

impl StableBuf for BytesMut

Implementors§