Skip to main content

binance_core/websocket/
engine.rs

1pub trait WebSocketEngine {
2    type Command;
3    type Error;
4    type Response;
5
6    fn connect(&mut self, stream: String) -> impl Future<Output = Result<(), Self::Error>> + Send;
7
8    fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send;
9    fn disconnect(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send;
10
11    fn handle(
12        &self,
13        message: tokio_tungstenite::tungstenite::Utf8Bytes,
14    ) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send;
15
16    fn select_action(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send;
17    fn run(&mut self) -> impl Future<Output = ()> + Send;
18}