Function base65536::decode [] [src]

pub fn decode<T: ?Sized>(
    input: &T,
    ignore_garbage: bool
) -> DecodeResult<Vec<u8>> where
    T: AsRef<str>, 

Decode from a reference to a base65536-encoded string as octets.

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;

assert_eq!(vec![1, 2, 3], decode("㘁ᔃ", false)?);
assert_eq!("hello world", String::from_utf8(decode("驨ꍬ啯𒁷ꍲᕤ", false)?)?);