Skip to main content

BufMut

Trait BufMut 

Source
pub trait BufMut {
    // Required methods
    fn len(&self) -> usize;
    fn append_slice(&mut self, val: &[u8]);
    fn set_slice(&mut self, pos: usize, val: &[u8]);

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn encode_atom<F>(&mut self, kind: impl Into<FourCC>, f: F) -> Result<()>
       where Self: Sized,
             F: FnOnce(&mut Self) -> Result<()> { ... }
}
Expand description

A mutable contiguous buffer of bytes.

Required Methods§

Source

fn len(&self) -> usize

Source

fn append_slice(&mut self, val: &[u8])

Source

fn set_slice(&mut self, pos: usize, val: &[u8])

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn encode_atom<F>(&mut self, kind: impl Into<FourCC>, f: F) -> Result<()>
where Self: Sized, F: FnOnce(&mut Self) -> Result<()>,

Write a box header (size(4) + kind(4)) with a placeholder size, run f to encode the body, then go back and patch the placeholder with the total number of bytes written (header included).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl BufMut for Vec<u8>

Source§

fn len(&self) -> usize

Source§

fn append_slice(&mut self, v: &[u8])

Source§

fn set_slice(&mut self, pos: usize, val: &[u8])

Source§

impl<T: BufMut + ?Sized> BufMut for &mut T

Source§

fn len(&self) -> usize

Source§

fn append_slice(&mut self, v: &[u8])

Source§

fn set_slice(&mut self, pos: usize, val: &[u8])

Implementors§