Trait vmap::Span

source ·
pub trait Span: Deref<Target = [u8]> + Sized + Span {
    // Required methods
    fn len(&self) -> usize;
    fn as_ptr(&self) -> *const u8;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn read_volatile<T: Scalar>(&self, offset: usize) -> T { ... }
    fn read_unaligned<T: Scalar>(&self, offset: usize) -> T { ... }
}
Expand description

General trait for working with any memory-safe representation of a contiguous region of arbitrary memory.

Required Methods§

source

fn len(&self) -> usize

Get the length of the allocated region.

source

fn as_ptr(&self) -> *const u8

Get the pointer to the start of the allocated region.

Provided Methods§

source

fn is_empty(&self) -> bool

Tests if the span covers zero bytes.

source

fn read_volatile<T: Scalar>(&self, offset: usize) -> T

Performs a volatile read of the value at a given offset.

Volatile operations are intended to act on I/O memory, and are guaranteed to not be elided or reordered by the compiler across other volatile operations.

source

fn read_unaligned<T: Scalar>(&self, offset: usize) -> T

Performs an unaligned read of the value at a given offset.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a> Span for &'a [u8]

source§

fn len(&self) -> usize

source§

fn as_ptr(&self) -> *const u8

source§

impl<'a> Span for &'a mut [u8]

source§

fn len(&self) -> usize

source§

fn as_ptr(&self) -> *const u8

Implementors§