1#![doc = include_str!("README.md")]
7
8#![allow(incomplete_features)]
10
11#![feature(const_trait_impl)]
13#![feature(unsized_const_params)]
14#![feature(adt_const_params)]
15#![feature(default_field_values)]
16#![feature(const_heap)]
17#![feature(const_default)]
18#![feature(never_type)]
19#![feature(generic_const_exprs)]
20
21mod state;
23
24pub use state::{
26 Same,
27 Name
28};
29
30use state::{
32 State,
33 Main,
34 DerivedState
35};
36
37use issuing::Issue;
39
40use systemstd::System;
42
43use systemio::{
45 SystemIO,
46 Update
47};
48
49
50pub struct Report<Current: State> {
56 data: Current
57}
58
59impl Report<Main> {
61 pub const fn new(name: &'static str) -> Self {
62 let mut chain = Vec::new();
63 chain.push(name);
64 return Self {
65 data: Main {
66 chain: chain
67 }
68 };
69 }
70}
71
72impl<Current: const State> Report<Current> {
74 pub const fn to<'valid, Following: const DerivedState<'valid>>(&'valid mut self) -> Report<Following> {
75 return Report {
76 data: Following::convert(&mut self.data)
77 }
78 }
79 pub fn issue(&self, object: impl Into<Issue>) -> Option<!> {
80 System::problem(object.into(), self.data.get()).sync();
81 return None;
82 }
83 pub fn eat<Type>(&self, result: Result<Type, Issue>) -> Option<Type> {return match result {
84 Ok(value) => Some(value),
85 Err(issue) => self.issue(issue)?
86 }}
87}
88
89const impl Default for Report<Main> {
91 fn default() -> Self {return Self::new("Main")}
92}