/// Writes data to self.vec[offset..], wrapping around the end of the Vec if necessary. Returns
/// the number of bytes written.
Writes data to self.vec[offset..], wrapping around the end of the Vec if necessary. Returns
the number of bytes written.
Writes data to self . vec [ offset .. ] wrapping around the end of the Vec if necessary . Returns the number of bytes written .
fn wrapped_write(&mut self, offset: usize, data: &[u8]) -> usize {
        let mut bytes: usize = 0;
        let ring_size = self.size();
        assert!(offset < ring_size);
        assert!(data.len() <= ring_size);
        let mut_u8_vec: &mut [u8]= self.vec_as_mut_u8();
        bytes += (&mut mut_u8_vec[offset..]).write(data).unwrap();
        if offset + data.len() > ring_size {
            let remaining = data.len() - bytes;
            bytes += (&mut mut_u8_vec[..remaining]).write(&data[bytes..]).unwrap();
        }
        bytes
    }
fn wrapped_write ( & mut self , offset : usize , data : & [ u8 ] ) -> usize { let mut bytes : usize = 0 ; let ring_size = self . size ( ) ; assert ! ( offset ring_size ) ; assert ! ( data len ( ) ring_size ) ; let mut_u8_vec : & mut [ u8 ] = self . vec_as_mut_u8 ( ) ; bytes += ( & mut mut_u8_vec [ offset .. ] ) . write ( data ) . unwrap ( ) ; if offset + data . len ( ) > ring_size { let remaining = data . len ( ) - bytes ; bytes += ( & mut mut_u8_vec [ .. remaining ] ) . write ( & data [ bytes .. ] ) . unwrap ( ) ; } bytes }
Writes data to self.vec[offset..], wrapping around the end of the Vec if necessary.
Writes data to self . vec [ offset .. ] wrapping around the end of the Vec if necessary .
&mut self
offset
usize
data
&[u8]