Skip to content

Commit 0d095c0

Browse files
authored
Merge branch 'main' into http-types-no-default-features
2 parents ce30bf2 + cddf71d commit 0d095c0

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ authors = [
1717
[features]
1818

1919
[dependencies]
20-
async-std = { version = "1.6.0", features = ["unstable"] }
20+
futures-lite = "1.11.3"
2121
http-types = { version = "2.10.0", default-features = false }
2222
log = "0.4.8"
2323
memchr = "2.3.3"
24-
pin-project-lite = "0.1.4"
24+
pin-project-lite = "0.2.7"
2525
async-channel = "1.1.1"
2626

2727
[dev-dependencies]

src/decoder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use async_std::io::BufRead as AsyncBufRead;
2-
use async_std::stream::Stream;
3-
use async_std::task::{self, Context, Poll};
1+
use crate::Lines;
2+
use futures_lite::prelude::*;
3+
use futures_lite::ready;
4+
use std::task::{Context, Poll};
45

56
use std::pin::Pin;
67

78
use crate::Event;
8-
use crate::Lines;
99

1010
/// Decode a new incoming SSE connection.
1111
pub fn decode<R>(reader: R) -> Decoder<R>
@@ -69,7 +69,7 @@ impl<R: AsyncBufRead + Unpin> Stream for Decoder<R> {
6969
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
7070
loop {
7171
// Get the next line, if available.
72-
let line = match task::ready!(Pin::new(&mut self.lines).poll_next(cx)) {
72+
let line = match ready!(Pin::new(&mut self.lines).poll_next(cx)) {
7373
None => return Poll::Ready(None),
7474
Some(Err(e)) => return Poll::Ready(Some(Err(e.into()))),
7575
Some(Ok(line)) => line,

src/encoder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use async_std::io::{BufRead as AsyncBufRead, Read as AsyncRead};
2-
use async_std::prelude::*;
3-
use async_std::task::{ready, Context, Poll};
1+
use futures_lite::prelude::*;
2+
use futures_lite::ready;
3+
use std::task::{Context, Poll};
44

55
use std::io;
66
use std::pin::Pin;

src/lines.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
use std::io;
12
use std::mem;
23
use std::pin::Pin;
34
use std::str;
45

56
use pin_project_lite::pin_project;
67

7-
use async_std::io::{self, BufRead};
8-
use async_std::stream::Stream;
9-
use async_std::task::{ready, Context, Poll};
8+
use futures_lite::prelude::*;
9+
use futures_lite::ready;
10+
use std::task::{Context, Poll};
1011

1112
pin_project! {
1213
/// A stream of lines in a byte stream.
@@ -31,7 +32,7 @@ pin_project! {
3132
impl<R> Lines<R> {
3233
pub(crate) fn new(reader: R) -> Lines<R>
3334
where
34-
R: BufRead + Unpin + Sized,
35+
R: AsyncBufRead + Unpin + Sized,
3536
{
3637
Lines {
3738
reader,
@@ -42,12 +43,12 @@ impl<R> Lines<R> {
4243
}
4344
}
4445

45-
impl<R: BufRead> Stream for Lines<R> {
46+
impl<R: AsyncBufRead> Stream for Lines<R> {
4647
type Item = io::Result<String>;
4748

4849
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
4950
let this = self.project();
50-
let n = async_std::task::ready!(read_line_internal(
51+
let n = ready!(read_line_internal(
5152
this.reader,
5253
cx,
5354
this.buf,
@@ -67,7 +68,7 @@ impl<R: BufRead> Stream for Lines<R> {
6768
}
6869
}
6970

70-
fn read_line_internal<R: BufRead + ?Sized>(
71+
fn read_line_internal<R: AsyncBufRead + ?Sized>(
7172
reader: Pin<&mut R>,
7273
cx: &mut Context<'_>,
7374
buf: &mut String,
@@ -91,7 +92,7 @@ fn read_line_internal<R: BufRead + ?Sized>(
9192
}
9293
}
9394

94-
fn read_until_internal<R: BufRead + ?Sized>(
95+
fn read_until_internal<R: AsyncBufRead + ?Sized>(
9596
mut reader: Pin<&mut R>,
9697
cx: &mut Context<'_>,
9798
buf: &mut Vec<u8>,

0 commit comments

Comments
 (0)