libutils_report/
shortcut.rs1use super::act::Act;
7
8use core::{
10 ops::{
11 FromResidual,
12 Residual,
13 Try,
14 ControlFlow
15 },
16 mem::transmute_neo as transmute,
17 marker::Destruct
18};
19
20
21pub struct Break;
27
28
29const impl<Type> FromResidual<Break> for Act<Type> {
35 fn from_residual(_residual: Break) -> Self {return unsafe {transmute(None::<Type>)}}
36}
37
38
39const impl<Type: [const] Destruct> Residual<Type> for Break {
45 type TryType = Act<Type>;
46}
47
48
49const impl<Type: [const] Destruct> Try for Act<Type> {
55 type Output = Type;
56 type Residual = Break;
57 fn from_output(output: Self::Output) -> Self {return unsafe {transmute(Some(output))}}
58 fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {return if let Some(value) = self.value() {
59 ControlFlow::Continue(value)
60 } else {ControlFlow::Break(Break)}}
61}