Skip to content

Commit

Permalink
Return impl AsyncBufRead from into_async_read
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarshgupta137 committed Nov 9, 2023
1 parent 315d88b commit 5ca448a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ references = ["smithy-rs#3126", "aws-sdk-rust#930"]
meta = { "breaking" = false, "tada" = false, "bug" = true }
author = "rcoh"

[[aws-sdk-rust]]
message = "Change `ByteStream::into_async_read` to return `AsyncBufRead`"
references = ["smithy-rs#3164"]
meta = { "breaking" = false, "tada" = false, "bug" = true }
author = "utkarshgupta137"

[[smithy-rs]]
message = "The HTTP `Request`, `Response`, `Headers`, and `HeaderValue` types have been moved from `aws_smithy_runtime_api::client::http::*` into `aws_smithy_runtime_api::http`"
references = ["smithy-rs#3138"]
Expand Down
5 changes: 2 additions & 3 deletions rust-runtime/aws-smithy-types/src/byte_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,18 +428,17 @@ impl ByteStream {
/// # Example
///
/// ```rust
/// use tokio::io::{BufReader, AsyncBufReadExt};
/// use aws_smithy_types::byte_stream::ByteStream;
///
/// # async fn dox(my_bytestream: ByteStream) -> std::io::Result<()> {
/// let mut lines = BufReader::new(my_bytestream.into_async_read()).lines();
/// let mut lines = my_bytestream.into_async_read().lines();
/// while let Some(line) = lines.next_line().await? {
/// // Do something line by line
/// }
/// # Ok(())
/// # }
/// ```
pub fn into_async_read(self) -> impl tokio::io::AsyncRead {
pub fn into_async_read(self) -> impl tokio::io::AsyncBufRead {
// The `Stream` trait is currently unstable so we can only use it in private.
// Here, we create a local struct just to enable the trait for `ByteStream` and pass it
// to `StreamReader`.
Expand Down

0 comments on commit 5ca448a

Please sign in to comment.