Add missing ?Sized bound in read_line

This commit is contained in:
Dario Nieuwenhuis 2020-12-27 23:34:05 +01:00
parent 692d8bb813
commit 32c67381df

View file

@ -127,7 +127,10 @@ pub trait AsyncBufReadExt: AsyncBufRead {
impl<R: AsyncBufRead + ?Sized> AsyncBufReadExt for R {}
pub async fn read_line<R: AsyncBufRead + Unpin>(r: &mut R, buf: &mut [u8]) -> Result<usize> {
pub async fn read_line<R: AsyncBufRead + Unpin + ?Sized>(
r: &mut R,
buf: &mut [u8],
) -> Result<usize> {
r.skip_while(|b| b == b'\r' || b == b'\n').await?;
let n = r.read_while(buf, |b| b != b'\r' && b != b'\n').await?;
r.skip_while(|b| b == b'\r').await?;