/// Write the length in bytes of a section before the section, the section will be 0 padded to an even byte length
Write the length in bytes of a section before the section, the section will be 0 padded to an even byte length
Write the length in bytes of a section before the section the section will be 0 padded to an even byte length
pub fn reserve_byte_length<
        Err: From<BitError>,
        F: Fn(&mut BitWriteStream<E>) -> Result<(), Err>,
    >(
        &mut self,
        length_bit_size: usize,
        body_fn: F,
    ) -> Result<(), Err> {
        self.reserve_int(length_bit_size, |stream| {
            let start = stream.bit_len();
            body_fn(stream)?;
            let end = stream.bit_len();
            let bit_len = end - start;
            let pad_len = (8 - (bit_len & 7)) & 7;
            stream.push_bits(0, pad_len);
            let byte_len = (bit_len + pad_len) / 8;
            Ok(byte_len as u64)
        })
    }
pub fn reserve_byte_length < Err : From < BitError > , F : Fn ( & mut BitWriteStream < E > ) -> Result < ( ) , Err > , > ( & mut self , length_bit_size : usize , body_fn : F , ) -> Result < ( ) , Err > { self . reserve_int ( length_bit_size , | stream | { let start = stream . bit_len ( ) ; body_fn ( stream ) ? ; let end = stream . bit_len ( ) ; let bit_len = end - start ; let pad_len = ( 8 - ( bit_len & 7 ) ) & 7 ; stream . push_bits ( 0 , pad_len ) ; let byte_len = ( bit_len + pad_len ) / 8 ; Ok ( byte_len as u64 ) } ) }
Write the length in bytes of a section before the section, the section will be 0 padded to an even byte length
Write the length in bytes of a section before the section the section will be 0 padded to an even byte length
&mut self
length_bit_size
usize
body_fn
F