cgp_dispatch/providers/matchers/
match_with_field_handlers.rs1use cgp_core::prelude::*;
2use cgp_handler::{
3 ComputerComponent, ComputerRefComponent, HandleFieldValue, HandlerComponent,
4 HandlerRefComponent, PromoteRef, TryComputerComponent, TryComputerRefComponent,
5 UseInputDelegate,
6};
7
8use crate::providers::matchers::to_field_handlers::{
9 ToInputFieldHandlers, ToInputFieldHandlersRef,
10};
11use crate::{MatchWithHandlers, MatchWithHandlersRef};
12
13pub struct MatchWithFieldHandlers<Provider = UseContext>(pub PhantomData<Provider>);
14
15pub type MatchWithValueHandlers<Provider = UseContext> =
16 MatchWithFieldHandlers<HandleFieldValue<Provider>>;
17
18pub type MatchWithFieldHandlersRef<Provider = UseContext> =
19 MatchWithFieldHandlers<PromoteRef<Provider>>;
20
21pub type MatchWithValueHandlersRef<Provider = UseContext> =
22 MatchWithFieldHandlers<HandleFieldValue<PromoteRef<Provider>>>;
23
24delegate_components! {
25 <Provider>
26 MatchWithFieldHandlers<Provider> {
27 [
28 ComputerComponent,
29 TryComputerComponent,
30 HandlerComponent,
31 ]:
32 UseInputDelegate<MatchWithFieldHandlersInputs<Provider>>,
33 }
34}
35
36delegate_components! {
37 <Input: ToInputFieldHandlers<Provider>, Provider>
38 new MatchWithFieldHandlersInputs<Provider> {
39 Input: MatchWithHandlers<Input::Handlers>
40 }
41}
42
43delegate_components! {
44 <Provider>
45 MatchWithFieldHandlers<Provider> {
46 [
47 ComputerRefComponent,
48 TryComputerRefComponent,
49 HandlerRefComponent,
50 ]:
51 UseInputDelegate<MatchWithFieldHandlersInputsRef<Provider>>
52 }
53}
54
55delegate_components! {
56 <
57 Input: for<'a> ToInputFieldHandlersRef<'a, Provider, Handlers = Handlers>,
58 Provider,
59 Handlers,
60 >
61 new MatchWithFieldHandlersInputsRef<Provider> {
62 Input:
63 PromoteRef<MatchWithHandlersRef<Handlers>>
64 }
65}