xref: /DragonReach/src/parse/parse_service/mod.rs (revision b58bd5a17ff5d5ea5385adc176e215cd2b9a485c)
1 use super::UnitParser;
2 use crate::error::ParseError;
3 use crate::unit::service::ServiceUnit;
4 
5 #[cfg(target_os = "dragonos")]
6 use drstd as std;
7 
8 use std::rc::Rc;
9 pub struct ServiceParser;
10 
11 impl ServiceParser {
12     /// @brief 解析Service类型Unit的
13     ///
14     /// 从path解析Service类型Unit
15     ///
16     /// @param path 需解析的文件路径
17     ///
18     /// @return 成功则返回Ok(Rc<ServiceUnit>),否则返回Err
19     pub fn parse(path: &str) -> Result<Rc<ServiceUnit>, ParseError> {
20         //交付总解析器
21         let service = UnitParser::parse::<ServiceUnit>(path, crate::unit::UnitType::Service)?;
22         return Ok(service);
23     }
24 }
25