mediator_sys/mediator/
builder.rs

1/// Trait for creating a builder
2/// that implements [`BuilderFlow`]
3/// for a mediator `M`.
4pub trait BuilderInternal<M, Flow>
5where
6    Flow: BuilderFlow<M>,
7    Self: Sized,
8{
9    fn builder() -> Flow;
10}
11
12/// A [`BuilderFlow`] is generic over `M`
13/// which is the mediator that will be
14/// built by [`BuilderFlow::build()`].
15pub trait BuilderFlow<M>
16where
17    Self: Sized,
18{
19    fn build(self) -> M;
20}
21
22/// Trait for creating a builder
23/// that implements [`TryBuilderFlow`]
24/// for a mediator `M`.
25pub trait TryBuilderInternal<M, Flow>
26where
27    Flow: TryBuilderFlow<M>,
28    Self: Sized,
29{
30    fn builder() -> Flow;
31}
32
33/// A [`TryBuilderFlow`] is generic over `M`
34/// which is the mediator that will be tried to be
35/// built by [`TryBuilderFlow::build()`].
36pub trait TryBuilderFlow<M>
37where
38    Self: Sized,
39{
40    type Error;
41    fn build(self) -> Result<M, Self::Error>;
42}