Skip to content

Commit e6953ac

Browse files
authored
Merge pull request #201 from forkgull/no-async-std
Replace async-std with smol crates
2 parents 882fa23 + 235de5b commit e6953ac

File tree

13 files changed

+48
-36
lines changed

13 files changed

+48
-36
lines changed

Cargo.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ readme = "README.md"
1818
edition = "2018"
1919

2020
[dependencies]
21-
httparse = "1.3.4"
22-
async-std = "1.7.0"
21+
async-channel = "1.5.1"
22+
async-dup = "1.2.2"
23+
async-global-executor = "2.3.1"
24+
async-io = "1.13.0"
25+
futures-lite = "1.13.0"
2326
http-types = { version = "2.9.0", default-features = false }
24-
futures-core = "0.3.8"
27+
httparse = "1.3.4"
2528
log = "0.4.11"
2629
pin-project = "1.0.2"
27-
async-channel = "1.5.1"
28-
async-dup = "1.2.2"
2930

3031
[dev-dependencies]
31-
pretty_assertions = "0.6.1"
3232
async-std = { version = "1.7.0", features = ["attributes"] }
33+
pretty_assertions = "0.6.1"

src/body_encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::io;
22
use std::pin::Pin;
33
use std::task::{Context, Poll};
44

5-
use async_std::io::Read;
5+
use futures_lite::io::AsyncRead as Read;
66
use http_types::Body;
77
use pin_project::pin_project;
88

src/chunked/decoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::future::Future;
33
use std::pin::Pin;
44
use std::task::{Context, Poll};
55

6-
use async_std::io::{self, Read};
7-
use futures_core::ready;
6+
use futures_lite::io::{self, AsyncRead as Read};
7+
use futures_lite::ready;
88
use http_types::trailers::{Sender, Trailers};
99

1010
/// Decodes a chunked body according to

src/chunked/encoder.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use std::pin::Pin;
2+
use std::task::{Context, Poll};
23

3-
use async_std::io;
4-
use async_std::io::prelude::*;
5-
use async_std::task::{Context, Poll};
6-
use futures_core::ready;
4+
use futures_lite::io::AsyncRead as Read;
5+
use futures_lite::{io, ready};
76

87
/// An encoder for chunked encoding.
98
#[derive(Debug)]

src/client/decode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use async_std::io::{BufReader, Read};
2-
use async_std::prelude::*;
1+
use futures_lite::io::{AsyncRead as Read, BufReader};
2+
use futures_lite::prelude::*;
33
use http_types::{ensure, ensure_eq, format_err};
44
use http_types::{
55
headers::{CONTENT_LENGTH, DATE, TRANSFER_ENCODING},

src/client/encode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::io::Write;
22
use std::pin::Pin;
3+
use std::task::{Context, Poll};
34

4-
use async_std::io::{self, Cursor, Read};
5-
use async_std::task::{Context, Poll};
5+
use futures_lite::io::{self, AsyncRead as Read, Cursor};
66
use http_types::headers::{CONTENT_LENGTH, HOST, TRANSFER_ENCODING};
77
use http_types::{Method, Request};
88

src/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Process HTTP connections on the client.
22
3-
use async_std::io::{self, Read, Write};
3+
use futures_lite::io::{self, AsyncRead as Read, AsyncWrite as Write};
44
use http_types::{Request, Response};
55

66
mod decode;

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ mod read_notifier;
112112
pub mod client;
113113
pub mod server;
114114

115-
use async_std::io::Cursor;
116115
use body_encoder::BodyEncoder;
117116
pub use client::connect;
117+
use futures_lite::io::Cursor;
118118
pub use server::{accept, accept_with_opts, ServerOptions};
119119

120120
#[derive(Debug)]

src/read_notifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::pin::Pin;
33
use std::task::{Context, Poll};
44

55
use async_channel::Sender;
6-
use async_std::io::{self, BufRead, Read};
6+
use futures_lite::io::{self, AsyncBufRead as BufRead, AsyncRead as Read};
77

88
/// ReadNotifier forwards [`async_std::io::Read`] and
99
/// [`async_std::io::BufRead`] to an inner reader. When the

src/server/body_reader.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
use crate::chunked::ChunkedDecoder;
22
use async_dup::{Arc, Mutex};
3-
use async_std::io::{BufReader, Read, Take};
4-
use async_std::task::{Context, Poll};
5-
use std::{fmt::Debug, io, pin::Pin};
3+
use futures_lite::io::{AsyncRead as Read, BufReader, Take};
4+
use std::{
5+
fmt::Debug,
6+
io,
7+
pin::Pin,
8+
task::{Context, Poll},
9+
};
610

711
pub enum BodyReader<IO: Read + Unpin> {
812
Chunked(Arc<Mutex<ChunkedDecoder<BufReader<IO>>>>),

0 commit comments

Comments
 (0)