1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[cfg(not(target_arch = "wasm32"))]
mod native;
#[cfg(not(target_arch = "wasm32"))]
pub use native::*;

#[cfg(target_arch = "wasm32")]
mod wasm;
#[cfg(target_arch = "wasm32")]
pub use wasm::*;

use thiserror::Error;

pub struct WebSocketClient<Tx, Rx> {
    tx: Tx,
    rx: Rx,
}

impl<Tx, Rx> WebSocketClient<Tx, Rx> {
    pub fn split(self) -> (Tx, Rx) {
        (self.tx, self.rx)
    }
}

#[non_exhaustive]
#[derive(Error, Clone, Debug, PartialEq, Eq)]
pub enum SinkError {
    // TODO: Refine
    #[error("send failed {0}")]
    Send(String),
}