pub trait ConfigurationParser: Send + Sync + Debug {
    // Required methods
    fn name(&self) -> String;
    fn supported_format_list(&self) -> Vec<String>;
    fn try_parse(&self, bytes: &[u8]) -> Result<Input>;
    fn is_format_supported(&self, bytes: &[u8]) -> Option<bool>;

    // Provided method
    fn parse(&self, bytes: &[u8]) -> Result<Input, ConfigurationParserError> { ... }
}
Expand description

A trait to parse configuration contents.

Required Methods§

source

fn name(&self) -> String

Name of this parser (e.g. “YAML”)

source

fn supported_format_list(&self) -> Vec<String>

Supported format list (e.g. “yml”)

source

fn try_parse(&self, bytes: &[u8]) -> Result<Input>

Parses a byte slice to Input.

source

fn is_format_supported(&self, bytes: &[u8]) -> Option<bool>

Checks if provided byte slice is ok for future parsing. (e.g. is it YAML at all or not)

Provided Methods§

Implementors§