hypershell_hash_components/providers/
bytes_to_hex.rs1use core::marker::PhantomData;
2
3use cgp::extra::handler::{Handler, HandlerComponent};
4use cgp::prelude::*;
5
6#[cgp_new_provider]
7impl<Context, Code, Input> Handler<Context, Code, Input> for HandleBytesToHex
8where
9 Context: HasAsyncErrorType,
10 Code: Send,
11 Input: Send + AsRef<[u8]>,
12{
13 type Output = String;
14
15 async fn handle(
16 _context: &Context,
17 _tag: PhantomData<Code>,
18 input: Input,
19 ) -> Result<String, Context::Error> {
20 let output = hex::encode(input);
21 Ok(output)
22 }
23}