Function a2lfile::load[][src]

pub fn load(
    filename: &str,
    a2ml_spec: Option<String>,
    logger: &mut dyn Logger,
    strict_parsing: bool
) -> Result<A2lFile, String>
Expand description

Load an a2l file

a2ml_spec is optional and contains a String that is valid A2ML that can be used while parsing the file in addition to the A2ML that might be contained inside the A2ML block in the file. If a definition is provided here and there is also an A2ML block in the file, then the definition provided here will be tried first during parsing.

logger is a reference to an object that implements the trait Logger and which will receive all warning messages generated during parsing

strict_parsing toggles strict parsing: If strict parsing is enabled, most warnings become errors.


fn main() {
    let mut logger = SomethingThatImplementsLogger::new();
    match a2lfile::load("example.a2l", None, &mut logger, true) {
        Ok(a2l_file) => {/* do something with it*/},
        Err(error_message) => println!("{}", error_message)
    }
}