inspect_format

Trait 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)

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<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§