1#![no_std]
7
8#![doc = include_str!("README.md")]
10
11#![allow(incomplete_features)]
13
14#![feature(const_trait_impl)]
16#![feature(unsized_const_params)]
17#![feature(adt_const_params)]
18#![feature(phantom_variance_markers)]
19#![feature(negative_impls)]
20#![feature(const_heap)]
21#![feature(const_default)]
22#![feature(generic_const_exprs)]
23
24extern crate alloc;
26
27mod root;
29
30pub use root::Root;
32
33use alloc::vec::Vec;
35
36use core::{
38 marker::PhantomCovariantLifetime,
39 ptr::NonNull
40};
41
42
43pub struct Report<'valid, const NAME: &'static str> {
49 chain: NonNull<Vec<&'static str>>,
50 _lifetime: PhantomCovariantLifetime<'valid>
51}
52
53impl<'valid, const NAME: &'static str> Report<'valid, NAME> {
55 pub const fn chain(&'valid self) -> &'valid [&'static str] {
56 return unsafe {self.chain.as_ref().as_slice()};
57 }
58 pub const fn to<'next, const OTHER: &'static str>(&'valid mut self) -> Report<'next, OTHER> where 'valid: 'next {
59 if !OTHER.is_empty() {unsafe {self.chain.as_mut().push(OTHER)};}
60 return Report {
61 chain: self.chain,
62 _lifetime: PhantomCovariantLifetime::new()
63 }
64 }
65}
66
67impl<'valid, const NAME: &'static str> Drop for Report<'valid, NAME> {
69 fn drop(&mut self) {if !NAME.is_empty() {unsafe {self.chain.as_mut().pop()};}}
70}
71
72impl<'valid, const NAME: &'static str> !Send for Report<'valid, NAME> {}
74
75impl<'valid, const NAME: &'static str> !Sync for Report<'valid, NAME> {}