Skip to content

Commit 9dd4774

Browse files
do-not-use-parker-timmermanunexge
authored andcommitted
runtime: add a method into_segments to AggregatedBytes (#2525)
* start, add a method to AggregatedBytes called into_segments * update CHANGELOG.next.toml
1 parent 73c447e commit 9dd4774

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.next.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,9 @@ message = "Add support for omitting session token in canonical requests for SigV
7474
references = ["smithy-rs#2473"]
7575
meta = { "breaking" = false, "tada" = false, "bug" = false }
7676
author = "martinjlowm"
77+
78+
[[aws-sdk-rust]]
79+
message = "Add `into_segments` method to `AggregatedBytes`, for zero-copy conversions."
80+
references = ["smithy-rs#2525"]
81+
meta = { "breaking" = false, "tada" = false, "bug" = false }
82+
author = "parker-timmerman"

rust-runtime/aws-smithy-http/src/byte_stream.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@ impl AggregatedBytes {
477477
self.0.copy_to_bytes(self.0.remaining())
478478
}
479479

480+
/// Convert this buffer into an [`Iterator`] of underlying non-contiguous segments of [`Bytes`]
481+
pub fn into_segments(self) -> impl Iterator<Item = Bytes> {
482+
self.0.into_inner().into_iter()
483+
}
484+
480485
/// Convert this buffer into a `Vec<u8>`
481486
pub fn to_vec(self) -> Vec<u8> {
482487
self.0

0 commit comments

Comments
 (0)