Skip to main content

active_reporting/
mod.rs

1//^
2//^ HEAD
3//^
4
5//> HEAD -> DOCS
6#![doc = include_str!("README.md")]
7
8//> HEAD -> LINTS
9#![allow(incomplete_features)]
10
11//> HEAD -> FEATURES
12#![feature(const_trait_impl)]
13#![feature(unsized_const_params)]
14#![feature(adt_const_params)]
15#![feature(negative_impls)]
16#![feature(const_heap)]
17#![feature(const_default)]
18#![feature(generic_const_exprs)]
19
20//> HEAD -> MODULES
21mod root;
22
23//> HEAD -> ROOT
24pub use root::Root;
25
26
27//^ 
28//^ REPORT
29//^ 
30
31//> REPORT -> STRUCT
32pub struct Report<'valid, const NAME: &'static str> {
33    chain: &'valid mut Vec<&'static str>
34}
35
36//> REPORT -> IMPLEMENTATION
37impl<'valid, const NAME: &'static str> Report<'valid, NAME> {
38    pub const fn chain(&'valid self) -> &'valid [&'static str] {return self.chain.as_slice()}
39    pub const fn to<const OTHER: &'static str>(&'valid mut self) -> Report<'valid, OTHER> {
40        if !OTHER.is_empty() {self.chain.push(OTHER);}
41        return Report {
42            chain: self.chain
43        }
44    }
45}
46
47//> REPORT -> DROP
48impl<'valid, const NAME: &'static str> Drop for Report<'valid, NAME> {
49    fn drop(&mut self) {if !NAME.is_empty() {self.chain.pop();}}
50}
51
52//> REPORT -> !SEND
53impl<'valid, const NAME: &'static str> !Send for Report<'valid, NAME> {}
54
55//> REPORT -> !SYNC
56impl<'valid, const NAME: &'static str> !Sync for Report<'valid, NAME> {}