pub trait AsExtendMut<'a>: 'a {
    // Required method
    unsafe fn unsafe_extend_mut(
        &mut self,
        len: usize
    ) -> Result<&mut [u8], OneErr>;

    // Provided methods
    fn extend_mut(&mut self, len: usize) -> Result<&mut [u8], OneErr> { ... }
    fn extend_mut_from_slice(&mut self, oth: &[u8]) -> Result<(), OneErr> { ... }
}
Expand description

Indicates we can append bytes without pre-initializing them.

Required Methods§

unsafe fn unsafe_extend_mut(&mut self, len: usize) -> Result<&mut [u8], OneErr>

§Safety

this is unsafe because the process could potentially

  • read uninitialized data from the returned slice
  • or fail to initialize the data in the returned slice

Provided Methods§

fn extend_mut(&mut self, len: usize) -> Result<&mut [u8], OneErr>

You probably don’t want this function… it leads to an extra slow initialization step. See unsafe_extend_mut or extend_mut_from_slice.

fn extend_mut_from_slice(&mut self, oth: &[u8]) -> Result<(), OneErr>

Extend this extendable buffer with given slice

Implementors§