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