Skip to content

Commit

Permalink
fixup! remove anyhow requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
stevefan1999-personal committed Jun 25, 2022
1 parent 4a87684 commit 33859a4
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 60 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ readme = "README.md"

[dependencies]
async-std = { version = "1.12.0", optional = true }
async-trait = { version = "0.1.56", optional = true }
base64 = { version = "0.13.0", default-features = false }
base64-simd = { version = "0.5.0", default-features = false, optional = true }
byteorder = { version = "1.4.3", default-features = false }
Expand Down Expand Up @@ -42,7 +43,7 @@ tokio-stream = { version = "0.1.9", features = ["net"] }
default = ["std"]
# default = []
std = []
async = ["std"]
async = ["std", "async-trait"]
tokio = ["dep:tokio", "async"]
futures = ["dep:futures", "async"]
smol = ["dep:smol", "async"]
Expand Down
4 changes: 2 additions & 2 deletions examples/client/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use embedded_websocket::{
framer::{Framer, FramerError, ReadResult},
WebSocketClient, WebSocketCloseStatusCode, WebSocketOptions, WebSocketSendMessageType,
};
use std::net::TcpStream;
use std::{error::Error, net::TcpStream};

fn main() -> Result<(), FramerError> {
fn main() -> Result<(), FramerError<impl Error>> {
// open a TCP stream to localhost port 1337
let address = "127.0.0.1:1337";
println!("Connecting to: {}", address);
Expand Down
3 changes: 2 additions & 1 deletion examples/client_async/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use embedded_websocket::{
framer::{Framer, FramerError, ReadResult},
WebSocketClient, WebSocketCloseStatusCode, WebSocketOptions, WebSocketSendMessageType,
};
use std::error::Error;

cfg_if::cfg_if! {
if #[cfg(feature = "tokio")] {
Expand All @@ -27,7 +28,7 @@ cfg_if::cfg_if! {
#[cfg_attr(feature = "async-std", async_std::main)]
#[cfg_attr(feature = "tokio", tokio::main)]
#[cfg_attr(feature = "smol", smol_potat::main)]
async fn main() -> Result<(), FramerError> {
async fn main() -> Result<(), FramerError<impl Error>> {
// open a TCP stream to localhost port 1337
let address = "127.0.0.1:1337";
println!("Connecting to: {}", address);
Expand Down
6 changes: 3 additions & 3 deletions examples/server/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Result<T> = std::result::Result<T, WebServerError>;
#[derive(Debug)]
pub enum WebServerError {
Io(std::io::Error),
Framer(FramerError),
Framer(FramerError<std::io::Error>),
WebSocket(ws::Error),
HttpError(String),
Utf8Error,
Expand All @@ -40,8 +40,8 @@ impl From<std::io::Error> for WebServerError {
}
}

impl From<FramerError> for WebServerError {
fn from(err: FramerError) -> WebServerError {
impl From<FramerError<std::io::Error>> for WebServerError {
fn from(err: FramerError<std::io::Error>) -> WebServerError {
WebServerError::Framer(err)
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/server_async/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ cfg_if::cfg_if! {
#[derive(Debug)]
pub enum WebServerError {
Io(std::io::Error),
Framer(FramerError),
Framer(FramerError<std::io::Error>),
WebSocket(ws::Error),
HttpError(String),
Utf8Error,
Expand All @@ -58,8 +58,8 @@ impl From<std::io::Error> for WebServerError {
}
}

impl From<FramerError> for WebServerError {
fn from(err: FramerError) -> WebServerError {
impl From<FramerError<std::io::Error>> for WebServerError {
fn from(err: FramerError<std::io::Error>) -> WebServerError {
WebServerError::Framer(err)
}
}
Expand Down

0 comments on commit 33859a4

Please sign in to comment.