pub fn encode<R: Read + ?Sized, W: Write + ?Sized>(
source: &mut R,
destination: &mut W,
) -> Result<usize>Expand description
Encodes the entire source into the Ecoji format and writes a UTF-8 representation of the encoded data to the provided destination.
If successful, returns the number of bytes which were written to the destination writer.
Returns an error when either source or destination operation has failed. No guarantees are made about the state of the destination if an error occurs, so it is possible for the destination to contain only a part of the encoded data.
Β§Examples
Successful encoding:
let input = "input data";
let mut output: Vec<u8> = Vec::new();
ecoji::encode(&mut input.as_bytes(), &mut output)?;
assert_eq!(output, "πΆπ²π²π
πππ₯π©".as_bytes());