1use super::Report;
7
8
9pub struct Root {
15 chain: Vec<&'static str>
16}
17
18impl Root {
20 pub const fn new(name: &'static str) -> Self {return Self {
21 chain: if name.is_empty() {Vec::new()} else {
22 let mut chain = Vec::new();
23 chain.push(name);
24 chain
25 }
26 }}
27 pub const fn chain(&self) -> &[&'static str] {return self.chain.as_slice()}
28 pub const fn to<'valid, const NAME: &'static str>(&'valid mut self) -> Report<'valid, NAME> {
29 if !NAME.is_empty() {self.chain.push(NAME);}
30 return Report {
31 chain: &mut self.chain
32 }
33 }
34}
35
36const impl Default for Root {
38 fn default() -> Self {return Self::new("Main")}
39}
40
41impl !Sync for Root {}