dfir_rs/util/
demux_enum.rs1pub use dfir_macro::DemuxEnum;
4
5#[diagnostic::on_unimplemented(
12 note = "ensure there is exactly one output for each enum variant.",
13 note = "ensure that the type for each output is a tuple of the field for the variant: `()`, `(a,)`, or `(a, b, ...)`."
14)]
15pub trait DemuxEnum<Outputs>: DemuxEnumBase {
16 fn demux_enum(self, outputs: &mut Outputs);
18}
19
20#[diagnostic::on_unimplemented(
22 note = "requires that the enum have only one variant.",
23 note = "ensure there are no missing outputs; there must be exactly one output for each enum variant."
24)]
25pub trait SingleVariant: DemuxEnumBase {
26 type Output;
28 fn single_variant(self) -> Self::Output;
30}
31
32#[diagnostic::on_unimplemented(note = "use `#[derive(dfir_rs::DemuxEnum)]`")]
34pub trait DemuxEnumBase {}