diff --git a/src/connectors/handler.rs b/src/connectors/handler.rs index db14a25..8cfe07b 100644 --- a/src/connectors/handler.rs +++ b/src/connectors/handler.rs @@ -3,7 +3,7 @@ use crate::providers::Endpoints; use std::{fmt::Debug, future::Future}; pub(crate) use tokio_tungstenite::tungstenite::protocol::Message; -pub(crate) trait EventHandler { +pub trait EventHandler { type Error: Debug; type Context; type Update; diff --git a/src/monitor/depth.rs b/src/monitor/depth.rs index 1b23d16..a0e28a6 100644 --- a/src/monitor/depth.rs +++ b/src/monitor/depth.rs @@ -53,7 +53,10 @@ impl super::Monitor for DepthConfig { >( provider, tx, - self.symbols.iter().map(|s| s.to_uppercase()).collect(), + self.symbols + .iter() + .map(|s| s.to_uppercase()) + .collect::>(), ) .await }) diff --git a/src/monitor/mod.rs b/src/monitor/mod.rs index d8571d5..6696f45 100644 --- a/src/monitor/mod.rs +++ b/src/monitor/mod.rs @@ -1,5 +1,5 @@ mod depth; -mod order_book; +pub mod order_book; use clap::{Subcommand, ValueEnum}; pub use depth::{Depth, DepthConfig, DepthHandler, DepthUpdate}; diff --git a/src/net/mod.rs b/src/net/mod.rs index 62d2873..f3c3c28 100644 --- a/src/net/mod.rs +++ b/src/net/mod.rs @@ -1,4 +1,4 @@ pub(crate) mod streaming; pub(crate) mod ws_adapter; -pub use streaming::Message; +pub use streaming::{Message, MultiSymbolStream}; diff --git a/src/net/streaming.rs b/src/net/streaming.rs index 96beb2f..f8c1b6a 100644 --- a/src/net/streaming.rs +++ b/src/net/streaming.rs @@ -12,13 +12,13 @@ use tokio_tungstenite::WebSocketStream; use tracing::debug; use tracing::{error, info}; -pub(crate) struct MultiSymbolStream; +pub struct MultiSymbolStream; impl MultiSymbolStream { - pub(crate) async fn stream( + pub async fn stream( provider: P, context: Context, - symbols: Vec, + symbols: impl AsRef<[String]>, ) where P: Endpoints + Sync + Clone + 'static, Context: Sync + Clone + 'static, @@ -26,10 +26,10 @@ impl MultiSymbolStream { { let ctrl_c = Terminate::new(); - let mut stream = Self::subscribe(&provider, &symbols).await; + let mut stream = Self::subscribe(&provider, symbols.as_ref()).await; let mut handler = - MonitorMultiplexor::::build(provider, &symbols, context) + MonitorMultiplexor::::build(provider, symbols.as_ref(), context) .await .unwrap();