From b07ca33e4ec272e053801f8465ee6aa270a6993c Mon Sep 17 00:00:00 2001 From: "crashkeys.dev" Date: Tue, 9 Dec 2025 22:00:31 +0100 Subject: [PATCH] actor: basic stdout sink for visualization. --- src/sink.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/sink.rs b/src/sink.rs index b39132e..020569f 100644 --- a/src/sink.rs +++ b/src/sink.rs @@ -33,6 +33,24 @@ pub type PostResult = Result<(), PostFailure>; /// the [SinkManager] and its sinks. pub trait QuoteSink: Actor + Message {} +/// A [QuoteSink] which will output the contents of each quote +/// over Stdout. Is primarily meant for testing and observing sink behavior. +#[derive(Actor)] +pub struct StdoutSink; + +impl Message for StdoutSink { + type Reply = PostResult; + + async fn handle( + &mut self, + PostQuote(quote): PostQuote, + _ctx: &mut Context, + ) -> Self::Reply { + println!("{}", quote.get()); + Ok(()) + } +} + /// Supervises all [QuoteSink] actors within the program, forwarding /// [PostQuote] messages to them as they are received. /// The SinkManager will attempt to reinitialize failed sinks upon -- 2.51.2