Trait inspect_format::WriteBytes

source ·
pub trait WriteBytes {
    // Required method
    fn get_slice_mut_at(
        &mut self,
        offset: usize,
        size: usize,
    ) -> Option<&mut [u8]>;

    // Provided methods
    fn get_slice_mut(&mut self, size: usize) -> Option<&mut [u8]> { ... }
    fn copy_from_slice_at(&mut self, offset: usize, bytes: &[u8]) { ... }
    fn copy_from_slice(&mut self, bytes: &[u8]) { ... }
    fn get_value_mut<T: ContainerValue>(
        &mut self,
        offset: usize,
    ) -> Option<&mut T> { ... }
    fn set_value<T: ContainerValue>(&mut self, offset: usize, value: T) { ... }
}
Expand description

Trait implemented by container to which bytes can be written.

Required Methods§

source

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

Returns an exclusive reference to a slice of the given size at the given offset if one exists of the exact size.

Provided Methods§

source

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

Returns an exclusive reference to a slice of the given size at the beginning of the container if one exists of the exact size.

source

fn copy_from_slice_at(&mut self, offset: usize, bytes: &[u8])

source

fn copy_from_slice(&mut self, bytes: &[u8])

source

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

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

source

fn set_value<T: ContainerValue>(&mut self, offset: usize, value: T)

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

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

Trait implemented by an Inspect container that can be written to.

source§

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

Implementors§