systemd_parser/
lib.rs

1
2extern crate itertools;
3#[macro_use]
4extern crate nom;
5#[macro_use]
6extern crate quick_error;
7
8pub mod errors;
9pub mod items;
10pub mod parser;
11
12#[cfg(test)]
13mod parser_test;
14#[cfg(test)]
15mod items_test;
16
17pub fn parse_string(input: &str) -> Result<items::SystemdUnit, errors::ParserError> {
18
19    // FIXME: this should be inside `parse_unit` but then, the lifetime would be wrong
20    let input = String::from(input).replace("\\\n", "");
21    let units = try!(parser::parse_unit(&input));
22    let systemd_unit = try!(items::SystemdUnit::new(&units));
23    Ok(systemd_unit)
24}
25