diff --git a/Cargo.toml b/Cargo.toml index 1dc2d7b..9aa2784 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ bytes = { version = "1.2.1", optional = true } [dev-dependencies] serde = { version = "1.0", features = ["derive"] } assert_matches = "1.5.0" -generator = "0.7" +generator = "0.8" itertools = "0.14.0" [package.metadata.docs.rs] diff --git a/src/de.rs b/src/de.rs index 8f26cbf..8bbc42c 100644 --- a/src/de.rs +++ b/src/de.rs @@ -471,17 +471,20 @@ mod tests { /// Generate subslices, plus stuffing empty slices into the returned /// iterator. - fn generate_subslices(mut bytes: &[u8], chunk_size: usize) -> impl Iterator { + fn generate_subslices<'a>( + mut bytes: &'a [u8], + chunk_size: usize, + ) -> impl Iterator + 'a { assert_ne!(chunk_size, 0); Gn::new_scoped(move |mut s| loop { for _ in 0..8 { // Stuffing empty slices - s.yield_(&bytes[..0]); + s.yield_with(&bytes[..0]); } let n = bytes.len().min(chunk_size); - s.yield_(&bytes[..n]); + s.yield_with(&bytes[..n]); bytes = &bytes[n..]; if bytes.is_empty() {