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