cgp_handler/components/
handler.rs1use core::marker::PhantomData;
2
3use cgp_core::component::UseDelegate;
4use cgp_core::prelude::*;
5
6#[async_trait]
7#[cgp_component {
8 provider: Handler,
9 derive_delegate: [
10 UseDelegate<Code>,
11 UseInputDelegate<Input>,
12 ],
13}]
14pub trait CanHandle<Code: Send, Input: Send>: HasAsyncErrorType {
15 type Output: Send;
16
17 async fn handle(
18 &self,
19 _tag: PhantomData<Code>,
20 input: Input,
21 ) -> Result<Self::Output, Self::Error>;
22}
23
24pub struct UseInputDelegate<Components>(pub PhantomData<Components>);