xref: /DragonReach/src/unit/target/mod.rs (revision 4e851715e713d4b9f10926924b8a727bd7cc6cb3)
1 use super::{BaseUnit, Unit};
2 use crate::error::ParseError;
3 use crate::parse::Segment;
4 use core::ops::Deref;
5 //use drstd as std;
6 use std::boxed::Box;
7 use std::rc::Rc;
8 use std::vec::Vec;
9 
10 #[derive(Default)]
11 pub struct TargetUnit {
12     unit_base: BaseUnit,
13     targets: Vec<Rc<dyn Unit>>,
14 }
15 
16 impl Deref for TargetUnit {
17     type Target = TargetUnit;
18     fn deref(&self) -> &Self::Target {
19         &self
20     }
21 }
22 
23 impl Unit for TargetUnit {
24     fn as_any(&self) -> &dyn core::any::Any {
25         self
26     }
27 
28     fn from_path(path: &str) -> Result<Rc<Self>, ParseError>
29     where
30         Self: Sized,
31     {
32         Ok(Rc::new(TargetUnit::default()))
33     }
34 
35     fn set_attr(&mut self, segement: Segment, attr: &str, val: &str) -> Result<(), ParseError> {
36         Ok(())
37     }
38 }
39