pub fn encode_to_string<R: Read + ?Sized>(source: &mut R) -> Result<String>Expand description
Encodes the entire source into the Ecoji format, storing the result of the encoding to a new owned string.
Returns a string with the encoded data if successful.
Failure conditions are exactly the same as those of the encode function;
because the encoding output is always a valid sequence of emoji code points, it is guaranteed
to be representable as a valid UTF-8 sequence.
Β§Examples
Successful encoding:
let input = "input data";
let output: String = ecoji::encode_to_string(&mut input.as_bytes())?;
assert_eq!(output, "πΆπ²π²π
πππ₯π©");