cgp_dispatch/providers/matchers/
match_with_field_handlers.rs

1use cgp_core::prelude::*;
2use cgp_handler::{PromoteRef, UseInputDelegate};
3
4use crate::providers::matchers::to_field_handlers::{HasFieldHandlers, MapExtractFieldAndHandle};
5use crate::{HandleFieldValue, MatchWithHandlers, MatchWithHandlersMut, MatchWithHandlersRef};
6
7pub type MatchWithFieldHandlers<Provider = UseContext> =
8    UseInputDelegate<MatchWithFieldHandlersInputs<Provider>>;
9
10pub type MatchWithValueHandlers<Provider = UseContext> =
11    UseInputDelegate<MatchWithFieldHandlersInputs<HandleFieldValue<Provider>>>;
12
13pub type MatchWithFieldHandlersRef<Provider = UseContext> =
14    UseInputDelegate<MatchWithFieldHandlersInputsRef<PromoteRef<Provider>>>;
15
16pub type MatchWithValueHandlersRef<Provider = UseContext> =
17    UseInputDelegate<MatchWithFieldHandlersInputsRef<HandleFieldValue<Provider>>>;
18
19pub type MatchWithValueHandlersMut<Provider = UseContext> =
20    UseInputDelegate<MatchWithFieldHandlersInputsMut<HandleFieldValue<Provider>>>;
21
22delegate_components! {
23    <Input: HasFieldHandlers<MapExtractFieldAndHandle<Provider>>, Provider>
24    new MatchWithFieldHandlersInputs<Provider> {
25        Input: MatchWithHandlers<Input::Handlers>
26    }
27}
28
29delegate_components! {
30    <Input: HasFieldHandlers<MapExtractFieldAndHandle<Provider>>, Provider>
31    new MatchWithFieldHandlersInputsRef<Provider> {
32        <'a> &'a Input:
33            MatchWithHandlersRef<Input::Handlers>,
34    }
35}
36
37delegate_components! {
38    <Input: HasFieldHandlers<MapExtractFieldAndHandle<Provider>>, Provider>
39    new MatchWithFieldHandlersInputsMut<Provider> {
40        <'a> &'a mut Input:
41            MatchWithHandlersMut<Input::Handlers>
42    }
43}