Skip to main content

active_reporting/
mod.rs

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