convert

Function convert 

Source
pub fn convert<I, O>(istream: &mut I, ostream: &mut O) -> Result<(), Error>
where I: Iterator<Item = Result<u8, InError>> + ?Sized, O: ByteWriter + ?Sized,
Expand description

Converts byte input stream format to byte output stream format

Iterates on bytes in istream and writes them to ostream.

§Errors

see ErrorType for error details.

§Examples

binary to hexadecimal conversion

use bread_cli::*;
const _0: u8 = '0' as u8;
const _1: u8 = '1' as u8;
const _4: u8 = '4' as u8;
const _5: u8 = '5' as u8;
const _A: u8 = 'a' as u8;
const _F: u8 = 'f' as u8;

let input = [ _0, _1, _0, _0, _1, _0, _1, _0, _0, _1, _0, _1, _1, _1, _1, _1, ];
let mut output = [0u8; 4];
let mut reader = binary::Reader::new(input.as_slice());
let mut writer = hexadecimal::Writer::new(output.as_mut_slice());
convert(&mut reader, &mut writer).unwrap();
assert_eq!([_4, _A, _5, _F], output);