blob: e9fce5e67e1ac57efd9b034a7a789e43b38da9a5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#[cfg(feature = "general_renderer")]
pub use general_renderer_groupped::*;
#[cfg(not(feature = "general_renderer"))]
pub use groupped::*;
#[cfg(feature = "general_renderer")]
mod general_renderer_groupped {
use serde::Serialize;
use crate::{AnyOutput, ChainProcess};
/// Used to mark a type with a unique enum ID, assisting dynamic dispatch
pub trait Groupped<Group>
where
Self: Sized + Serialize + 'static,
{
/// Returns the specific enum value representing its ID within that enum
fn member_id() -> Group;
/// Converts the grouped item into a `ChainProcess` directed to the chain route.
///
/// This wraps the item into an `AnyOutput` and routes it to the chain processing pipeline.
fn to_chain(self) -> ChainProcess<Group>
where
Self: Send + Serialize,
{
AnyOutput::new(self).route_chain()
}
/// Converts the grouped item into a `ChainProcess` directed to the render route.
///
/// This wraps the item into an `AnyOutput` and routes it to the render processing pipeline.
fn to_render(self) -> ChainProcess<Group>
where
Self: Send + Serialize,
{
AnyOutput::new(self).route_renderer()
}
}
}
#[cfg(not(feature = "general_renderer"))]
mod groupped {
use crate::{AnyOutput, ChainProcess};
/// Used to mark a type with a unique enum ID, assisting dynamic dispatch
pub trait Groupped<Group>
where
Self: Sized + 'static,
{
/// Returns the specific enum value representing its ID within that enum
fn member_id() -> Group;
/// Converts the grouped item into a `ChainProcess` directed to the chain route.
///
/// This wraps the item into an `AnyOutput` and routes it to the chain processing pipeline.
fn to_chain(self) -> ChainProcess<Group>
where
Self: Send,
{
AnyOutput::new(self).route_chain()
}
/// Converts the grouped item into a `ChainProcess` directed to the render route.
///
/// This wraps the item into an `AnyOutput` and routes it to the render processing pipeline.
fn to_render(self) -> ChainProcess<Group>
where
Self: Send,
{
AnyOutput::new(self).route_renderer()
}
}
}
|