Compare commits

...

4 Commits

Author SHA1 Message Date
Øystein Olsen ce2d464bb7
Merge bc1fc998c0 into cdf5d64e6f 2024-03-17 23:04:29 -06:00
John Nunley cdf5d64e6f
v2.3.0
Signed-off-by: John Nunley <dev@notgull.net>
2024-03-17 14:49:37 -07:00
Øystein Olsen bc1fc998c0 Fill buffer with content of string buffer 2022-10-01 17:04:06 +02:00
Øystein Olsen 12169e5f12 Add failing test for read_line
read_line discards existing string buffer
2022-10-01 17:03:55 +02:00
3 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,7 @@
# Version 2.3.0
- Add `StreamExt::drain` for draining objects from a `Stream` without waiting (#70).
# Version 2.2.0
- Relax `Unpin` bounds on `io::copy`. (#87)

View File

@ -3,7 +3,7 @@ name = "futures-lite"
# When publishing a new version:
# - Update CHANGELOG.md
# - Create "v2.x.y" git tag
version = "2.2.0"
version = "2.3.0"
authors = [
"Stjepan Glavina <stjepang@gmail.com>",
"Contributors to futures-rs",

View File

@ -1648,11 +1648,17 @@ pub trait AsyncBufReadExt: AsyncBufRead {
/// use futures_lite::io::{AsyncBufReadExt, BufReader};
///
/// # spin_on::spin_on(async {
/// let input: &[u8] = b"hello";
/// let input: &[u8] = b"hello\nworld";
/// let mut reader = BufReader::new(input);
///
/// let mut line = String::new();
/// let n = reader.read_line(&mut line).await?;
/// assert_eq!(n, 6);
/// assert_eq!(line, "hello\n");
///
/// let n = reader.read_line(&mut line).await?;
/// assert_eq!(n, 5);
/// assert_eq!(line, "hello\nworld");
/// # std::io::Result::Ok(()) });
/// ```
fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLineFuture<'_, Self>
@ -1661,8 +1667,8 @@ pub trait AsyncBufReadExt: AsyncBufRead {
{
ReadLineFuture {
reader: self,
bytes: mem::take(buf).into_bytes(),
buf,
bytes: Vec::new(),
read: 0,
}
}