Skip to content

Commit

Permalink
v0.1.12: fix split_off
Browse files Browse the repository at this point in the history
  • Loading branch information
TimLuq committed Dec 6, 2024
1 parent 3028c46 commit 0bc0f63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bytedata"
version = "0.1.11"
version = "0.1.12"
edition = "2021"
rust-version = "1.75"
description = "Representation of a byte slice that is either static, borrowed, or shared."
Expand Down
4 changes: 2 additions & 2 deletions src/queue/byte_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,11 @@ impl<'a> ByteQueue<'a> {
pub fn split_off(&mut self, at: usize) -> Self {
fn inner<'a>(this: &mut ByteQueue<'a>, at: usize) -> ByteQueue<'a> {
let mut out = ByteQueue::new();
let mut remain = at;
let mut remain = this.len() - at;
while let Some(av) = this.pop_back() {
let len = av.len();
if len > remain {
let (av, bv) = av.split_at(remain);
let (av, bv) = av.split_at(len - remain);
this.push_back(av);
out.push_front(bv);
return out;
Expand Down

0 comments on commit 0bc0f63

Please sign in to comment.