Function base65536::decode_buf
[−]
[src]
pub fn decode_buf<T: ?Sized>(
input: &T,
buf: &mut Vec<u8>,
ignore_garbage: bool
) -> DecodeResult<()> where
T: AsRef<str>,
Decode from a reference to a base65536-encoded string as octets. Writes into the supplied output buffer, growing it if needed.
Errors
If the input string contains a character not inside of a base65536 block,
Error::InvalidCodePoint
will be retuned, along with the bad character,
and it's position in the input.
Note that decode
and decode_buf
are very strict by default, even
failing on line breaks (such as those generated by encode
and
encode_buf
when wrapping is enabled), as to match behaviour with the
original implementation. To prevent this, use with the ignore_garbage
option.
If the base65536 stream continues after a terminating padding character,
Error::InvalidLength
is returned.
Examples
use base65536::decode_buf; let mut buf = Vec::new(); decode_buf("㘁ᔃ", &mut buf, false)?; assert_eq!(vec![1, 2, 3], buf); let mut buf = Vec::new(); decode_buf("驨ꍬ啯𒁷ꍲᕤ", &mut buf, false)?; assert_eq!("hello world", String::from_utf8(buf)?);