inspect_format

Trait ReadBytes

Source
pub trait ReadBytes: BlockContainer {
    // Required method
    fn get_slice_at(&self, offset: usize, size: usize) -> Option<&[u8]>;

    // Provided methods
    fn get_slice(&self, size: usize) -> Option<&[u8]> { ... }
    fn get_value<T: ContainerValue>(&self, offset: usize) -> Option<&T> { ... }
}
Expand description

Trait implemented by an Inspect container that can be read from.

Required Methods§

Source

fn get_slice_at(&self, offset: usize, size: usize) -> Option<&[u8]>

Returns a slice of the given size at the given offset if one exists of the exact size.

Provided Methods§

Source

fn get_slice(&self, size: usize) -> Option<&[u8]>

Returns a slice of the given size at the beginning of the container if one exists of the exact size.

Source

fn get_value<T: ContainerValue>(&self, offset: usize) -> Option<&T>

Returns a reference to the value at the give offset, if one exists.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ReadBytes for Vec<u8>

Source§

fn get_slice_at(&self, offset: usize, size: usize) -> Option<&[u8]>

Source§

impl ReadBytes for [u8]

Source§

fn get_slice_at(&self, offset: usize, size: usize) -> Option<&[u8]>

Source§

impl<const N: usize> ReadBytes for [u8; N]

Source§

fn get_slice_at(&self, offset: usize, size: usize) -> Option<&[u8]>

Implementors§