// Writes bytes to a writer (unless bytes is empty). If padded = true,
// and bytes is non-empty, padding is first removed from bytes.
Writes bytes to a writer (unless bytes is empty). If padded = true,
and bytes is non-empty, padding is first removed from bytes.
Writes bytes to a writer ( unless bytes is empty ) . If padded = true and bytes is non - empty padding is first removed from bytes .
pub fn write_pt(block: Vec<u8>, writer: &mut Write, padded: bool) 
        ->  Result<(), Error> {
    // Don't bother with empty input.
    if block.len() == 0 {
        return Ok(());
    }
    // Remove padding, if requested.
    let byte_vec = match padded {
        false => block, 
        true => match remove_padding(block) {
            // Bail out if no bytes are left after padding removed.
            None => { return Ok(()); },
            Some(b) => b
        }
    };
    // Write the bytes to the file.
    try!(writer.write_all(&byte_vec[..]));
    Ok(())
}
pub fn write_pt ( block : Vec < u8 > , writer : & mut Write , padded : bool ) -> Result < ( ) , Error > { // Don't bother with empty input. if block . len ( ) == 0 { return Ok ( ( ) ) ; } // Remove padding, if requested. let byte_vec = match padded { false => block , true => match remove_padding ( block ) { // Bail out if no bytes are left after padding removed. None => { return Ok ( ( ) ) ; } , Some ( b ) => b } } ; // Write the bytes to the file. try ! ( writer write_all ( byte_vec [ ] ) ) ; Ok ( ( ) ) }
Writes bytes to a writer (unless bytes is empty).
Writes bytes to a writer ( unless bytes is empty ) .
block
Vec<u8>
writer
&mut Write
padded
bool