Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org).

## [1.1.2] - 2025-10-02

Simplify `Buf::chunks_vectored` implementations for `BufList` and `Cursor<T>`.

## [1.1.1] - 2025-10-01

### Added
Expand Down Expand Up @@ -74,6 +78,7 @@ This project adheres to [Semantic Versioning](https://semver.org).

- Initial release.

[1.1.2]: https://github.com/sunshowers-code/buf-list/releases/tag/1.1.2
[1.1.1]: https://github.com/sunshowers-code/buf-list/releases/tag/1.1.1
[1.1.0]: https://github.com/sunshowers-code/buf-list/releases/tag/1.1.0
[1.0.3]: https://github.com/sunshowers-code/buf-list/releases/tag/1.0.3
Expand Down
5 changes: 2 additions & 3 deletions src/cursor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,8 @@ impl<T: AsRef<BufList>> Buf for Cursor<T> {
let to_fill = (iovs.len()).min(list.num_chunks() - current_chunk);
for (i, iov) in iovs.iter_mut().enumerate().take(to_fill).skip(1) {
*iov = IoSlice::new(
&list
.get_chunk(current_chunk + i)
.expect("chunk is in range")[..],
list.get_chunk(current_chunk + i)
.expect("chunk is in range"),
);
}

Expand Down
13 changes: 4 additions & 9 deletions src/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,12 @@ impl Buf for BufList {
return 0;
}

// Loop over the buffers in the replay buffer list, and try to fill as
// many iovecs as we can from each buffer.
let mut filled = 0;
for buf in &self.bufs {
filled += buf.chunks_vectored(&mut iovs[filled..]);
if filled == iovs.len() {
return filled;
}
let to_fill = (iovs.len()).min(self.bufs.len());
for (i, iov) in iovs.iter_mut().enumerate().take(to_fill) {
*iov = IoSlice::new(&self.bufs[i]);
}

filled
to_fill
}

fn advance(&mut self, mut amt: usize) {
Expand Down