pub fn parse_sections(input: &str) -> Result<Vec<Section<'_>>, Error>Expand description
Parse a string representing a haproxy config to list of sections.
Preservers comments and the order of the sections and their options.
Unknown sections will result in multiple UnknownLine entries.
You can build a more strongly typed Config struct from the output, see example
below.
§Errors
Returns an error on unsupported or wrong haproxy config.
§Examples
use haproxy_config::parse_sections;
use haproxy_config::Config;
let file = include_str!("../tests/medium_haproxy.cfg");
let sections = parse_sections(file).unwrap();
// Build a config from the sections
let config = Config::try_from(sections.as_slice()).unwrap();