Skip to content

Commit 33859a4

Browse files
fixup! remove anyhow requirement
1 parent 4a87684 commit 33859a4

File tree

6 files changed

+134
-60
lines changed

6 files changed

+134
-60
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ readme = "README.md"
1212

1313
[dependencies]
1414
async-std = { version = "1.12.0", optional = true }
15+
async-trait = { version = "0.1.56", optional = true }
1516
base64 = { version = "0.13.0", default-features = false }
1617
base64-simd = { version = "0.5.0", default-features = false, optional = true }
1718
byteorder = { version = "1.4.3", default-features = false }
@@ -42,7 +43,7 @@ tokio-stream = { version = "0.1.9", features = ["net"] }
4243
default = ["std"]
4344
# default = []
4445
std = []
45-
async = ["std"]
46+
async = ["std", "async-trait"]
4647
tokio = ["dep:tokio", "async"]
4748
futures = ["dep:futures", "async"]
4849
smol = ["dep:smol", "async"]

examples/client/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use embedded_websocket::{
1313
framer::{Framer, FramerError, ReadResult},
1414
WebSocketClient, WebSocketCloseStatusCode, WebSocketOptions, WebSocketSendMessageType,
1515
};
16-
use std::net::TcpStream;
16+
use std::{error::Error, net::TcpStream};
1717

18-
fn main() -> Result<(), FramerError> {
18+
fn main() -> Result<(), FramerError<impl Error>> {
1919
// open a TCP stream to localhost port 1337
2020
let address = "127.0.0.1:1337";
2121
println!("Connecting to: {}", address);

examples/client_async/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use embedded_websocket::{
1313
framer::{Framer, FramerError, ReadResult},
1414
WebSocketClient, WebSocketCloseStatusCode, WebSocketOptions, WebSocketSendMessageType,
1515
};
16+
use std::error::Error;
1617

1718
cfg_if::cfg_if! {
1819
if #[cfg(feature = "tokio")] {
@@ -27,7 +28,7 @@ cfg_if::cfg_if! {
2728
#[cfg_attr(feature = "async-std", async_std::main)]
2829
#[cfg_attr(feature = "tokio", tokio::main)]
2930
#[cfg_attr(feature = "smol", smol_potat::main)]
30-
async fn main() -> Result<(), FramerError> {
31+
async fn main() -> Result<(), FramerError<impl Error>> {
3132
// open a TCP stream to localhost port 1337
3233
let address = "127.0.0.1:1337";
3334
println!("Connecting to: {}", address);

examples/server/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type Result<T> = std::result::Result<T, WebServerError>;
2828
#[derive(Debug)]
2929
pub enum WebServerError {
3030
Io(std::io::Error),
31-
Framer(FramerError),
31+
Framer(FramerError<std::io::Error>),
3232
WebSocket(ws::Error),
3333
HttpError(String),
3434
Utf8Error,
@@ -40,8 +40,8 @@ impl From<std::io::Error> for WebServerError {
4040
}
4141
}
4242

43-
impl From<FramerError> for WebServerError {
44-
fn from(err: FramerError) -> WebServerError {
43+
impl From<FramerError<std::io::Error>> for WebServerError {
44+
fn from(err: FramerError<std::io::Error>) -> WebServerError {
4545
WebServerError::Framer(err)
4646
}
4747
}

examples/server_async/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ cfg_if::cfg_if! {
4646
#[derive(Debug)]
4747
pub enum WebServerError {
4848
Io(std::io::Error),
49-
Framer(FramerError),
49+
Framer(FramerError<std::io::Error>),
5050
WebSocket(ws::Error),
5151
HttpError(String),
5252
Utf8Error,
@@ -58,8 +58,8 @@ impl From<std::io::Error> for WebServerError {
5858
}
5959
}
6060

61-
impl From<FramerError> for WebServerError {
62-
fn from(err: FramerError) -> WebServerError {
61+
impl From<FramerError<std::io::Error>> for WebServerError {
62+
fn from(err: FramerError<std::io::Error>) -> WebServerError {
6363
WebServerError::Framer(err)
6464
}
6565
}

0 commit comments

Comments
 (0)