-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Not actually releasing it _yet_ but this gets it in a place where I can - Exposing it at the top-level - Deprecating the old code - Re-organising a bit to make cleaning up later easier - Updating examples
- Loading branch information
Showing
15 changed files
with
119 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1 @@ | ||
#[cfg(not(target_arch = "wasm32"))] | ||
mod tokio_spawner { | ||
pub struct TokioSpawner(tokio::runtime::Handle); | ||
|
||
impl TokioSpawner { | ||
pub fn new(handle: tokio::runtime::Handle) -> Self { | ||
TokioSpawner(handle) | ||
} | ||
|
||
pub fn current() -> Self { | ||
TokioSpawner::new(tokio::runtime::Handle::current()) | ||
} | ||
} | ||
|
||
impl futures::task::Spawn for TokioSpawner { | ||
fn spawn_obj( | ||
&self, | ||
obj: futures::task::FutureObj<'static, ()>, | ||
) -> Result<(), futures::task::SpawnError> { | ||
self.0.spawn(obj); | ||
Ok(()) | ||
} | ||
} | ||
} | ||
#[cfg(not(target_arch = "wasm32"))] | ||
pub use tokio_spawner::TokioSpawner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#[derive(thiserror::Error, Debug)] | ||
/// Error type | ||
pub enum Error { | ||
/// Unknown error | ||
#[error("unknown: {0}")] | ||
Unknown(String), | ||
/// Custom error | ||
#[error("{0}: {1}")] | ||
Custom(String, String), | ||
/// Unexpected close frame | ||
#[error("got close frame. code: {0}, reason: {1}")] | ||
Close(u16, String), | ||
/// Decoding / parsing error | ||
#[error("message decode error, reason: {0}")] | ||
Decode(String), | ||
/// Serializing error | ||
#[error("couldn't serialize message, reason: {0}")] | ||
Serializing(String), | ||
/// Sending error | ||
#[error("message sending error, reason: {0}")] | ||
Send(String), | ||
/// Futures spawn error | ||
#[error("futures spawn error, reason: {0}")] | ||
SpawnHandle(String), | ||
/// Sender shutdown error | ||
#[error("sender shutdown error, reason: {0}")] | ||
SenderShutdown(String), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#![allow(deprecated)] | ||
|
||
pub mod client; | ||
#[cfg(feature = "ws_stream_wasm")] | ||
pub mod wasm; | ||
pub mod websockets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.