acceptor_std/printer/
debug_printer.rs

1use core::fmt;
2
3use accepts::{Accepts, AsyncAccepts};
4
5/// Prints values using `Debug` formatting.
6#[must_use = "DebugPrinter must be used to emit output"]
7#[derive(Debug, Clone)]
8pub struct DebugPrinter;
9
10impl<Value> Accepts<Value> for DebugPrinter
11where
12    Value: fmt::Debug,
13{
14    fn accept(&self, value: Value) {
15        println!("{value:?}");
16    }
17}
18
19impl<Value> AsyncAccepts<Value> for DebugPrinter
20where
21    Value: fmt::Debug + Send,
22{
23    fn accept_async<'a>(&'a self, value: Value) -> impl core::future::Future<Output = ()> + 'a
24    where
25        Value: 'a,
26    {
27        async move {
28            println!("{value:?}");
29        }
30    }
31}