cross_websocket/
lib.rs

1#[cfg(not(target_arch = "wasm32"))]
2mod native;
3#[cfg(not(target_arch = "wasm32"))]
4pub use native::*;
5
6#[cfg(target_arch = "wasm32")]
7mod wasm;
8#[cfg(target_arch = "wasm32")]
9pub use wasm::*;
10
11pub use eyre::{Report, Result};
12
13use thiserror::Error;
14
15pub struct WebSocketClient<Tx, Rx> {
16    tx: Tx,
17    rx: Rx,
18}
19
20impl<Tx, Rx> WebSocketClient<Tx, Rx> {
21    pub fn split(self) -> (Tx, Rx) {
22        (self.tx, self.rx)
23    }
24}
25
26#[non_exhaustive]
27#[derive(Error, Clone, Debug, PartialEq, Eq)]
28pub enum SinkError {
29    // TODO: Refine
30    #[error("send failed {0}")]
31    Send(String),
32}