use std::{convert::Infallible, fmt::Debug}; use {eyre::Result, rxrust::ops::box_it::CloneableBoxOpThreads, tonic::async_trait}; pub mod redis; /// ๐ŸŽ ยป represents a value that can be serialized to a bus value pub trait ToBusVal { fn to_bus_val(&self) -> Vec<(String, String)>; } /// ๐ŸŽ ยป represents a value that can be serialized to a bus key pub trait ToBusKey { fn to_bus_key(&self) -> String; } /// ๐ŸŽ ยป represents a value that can be serialized to and from a bus message pub trait ToFromBusMessage { fn as_message(&self) -> String; fn from_message>(msg: T) -> Self; } /// ๐ŸŽ ยป supertrait combining all bus object traits + debug + send + sync + 'static pub trait BusMessage: ToBusVal + ToBusKey + ToFromBusMessage + Debug + Clone + Send + Sync + PartialEq + 'static { } /// ๐ŸŽ ยป trait for bus **Publisher**s #[async_trait] pub trait PublisherTrait { /// ๐ŸŽ ยป publish a message to the bus async fn publish(&mut self, value: RM) -> Result<()>; } /// ๐ŸŽ ยป trait for bus **Publisher**s #[async_trait] pub trait SubscriberTrait { /// ๐ŸŽ ยป **stream** /// /// returns an `Observable` stream of messages from the redis bus async fn stream(&mut self) -> Result>; }