Trait lib_ruby_parser::source::CustomDecoder [−][src]
A trait to implement custom decoder.
Decoder is what is used if input source has encoding that is not supported out of the box.
Supported encoding are:
- UTF-8
- ASCII-8BIT (or BINARY, it’s an alias)
So if your source looks like this:
# encoding: koi8-r
\xFF = 42
you need to provide a decoder that converts this byte sequence into UTF-8 bytes.
Required methods
fn decode(&self, encoding: &str, input: &[u8]) -> Result<Vec<u8>, InputError>
[src]
Decoding function
Takes encoding name and initial input as arguments
and returns Ok(decoded)
vector of bytes or Err(error)
that will be returned
in the ParserResult::diagnostics
vector.