ta name='robots' content='index, nofollow'/>
aboutsummaryrefslogtreecommitdiff
path: root/bytes/buf/limit (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2024-05-19Fix iter tests to use the actual bytes IntoIter instead of std (#707)Gravatar Paolo Barbolini 1-4/+4
2024-05-11Offset from (#705)Gravatar Brad Dunbar 3-39/+20
2024-05-05Add zero-copy make_mut (#695)Gravatar Émile Fugulin 4-2/+341
2024-05-05ci: silence unexpected-cfgs warnings due to `#[cfg(loom)]` (#703)Gravatar Alice Ryhl 1-0/+1
2024-04-26Tweak clear and truncate length modifications (#700)Gravatar Alice Ryhl 1-8/+6
2024-04-25Improve BytesMut::split suggestion (#699)Gravatar Paolo Barbolini 1-1/+1
2024-04-25Reuse capacity when possible in <BytesMut as Buf>::advance impl (#698)Gravatar Paolo Barbolini 1-0/+8
2024-04-24Bytes::split_off - check fast path first (#693)Gravatar Brad Dunbar 1-7/+7
Follow up to https://github.com/tokio-rs/bytes/pull/689 * If `at == self.len()`, we already know `at <= self.len()`. * If `at == 0`, we already know `at <= self.len()`.
2024-04-24Resize refactor (#696)Gravatar Brad Dunbar 1-9/+17
* use checked_sub * return when additional == 0 * move safe operation out of unsafe block * use spare_capacity_mut instead of chunk_mut We don't need to check capacity because it's already been reserved above. * Add safety comments * refactor to use guard clauses This would be better written with let-else, but we won't get that until `MSRV >= 1.65.x`. * use if-let instead of unwrap * reduce scope of unsafe blocks Co-authored-by: Alice Ryhl <aliceryhl@google.com> --------- Co-authored-by: Alice Ryhl <aliceryhl@google.com>
2024-04-17Truncate tweaks (#694)Gravatar Brad Dunbar 1-1/+2
2024-04-11test(benches): encloses bytes into `test::black_box` for clone benches (#691)Gravatar Joseph Perez 1-3/+3
Closes #690 Without it, it seems to me that compiler is able to inline the vtable, resulting in similar results for `clone_shared` and `clone_arg_vec`.
2024-04-10perf: improve Bytes::copy_to_bytes (#688)Gravatar tison 1-7/+1
Signed-off-by: tison <wander4096@gmail.com>
2024-04-10Bytes::split_to - check fast path first (#689)Gravatar Brad Dunbar 1-7/+7
If `at == self.len()` then we already know `at <= self.len()`. If `at == 0`, it can't be greater than `self.len()`.
2024-04-09Don't set `len` in `BytesMut::reserve` (#682)Gravatar Brad Dunbar 1-2/+2
A fundamental invariant of `reserve` is that it can extend capacity while the stored data remains the same, even if it's moved to a new allocation. As a result, `len` can never change during a call to `reserve`.
2024-04-08Bytes: Use ManuallyDrop instead of mem::forget (#678)Gravatar Brad Dunbar 1-9/+11
2024-03-22chore: prepare bytes v1.6.0 (#681)v1.6.0Gravatar Brad Dunbar 2-1/+38
2024-03-14Use ManuallyDrop instead of mem::forget (#675)Gravatar Brad Dunbar 1-14/+12
2024-03-04Remove commented tests for Bytes::unsplit (#677)Gravatar Brad Dunbar 1-91/+0
Bytes doesn't have an unsplit method anymore. We can always retrieve these from git history if necessary.
2024-03-04Remove redundant reserve call (#674)Gravatar Brad Dunbar 2-2/+22
2024-03-03copy_to_bytes: Add panic section to docs (#676)Gravatar Brad Dunbar 1-0/+4
Fixes #454.
2024-03-03Use Iterator from the prelude (#673)Gravatar Brad Dunbar 1-1/+1
CI is [failing][failure] due to unused_imports because Iterator is already in the prelude. Removing it fixes things up. [failure]: https://github.com/tokio-rs/bytes/actions/runs/8034858583/job/21946873895
2024-02-23Refactor split_at/split_to (#663)Gravatar Brad Dunbar 1-26/+24
* set len a little more concisely * inline set_end * remove kind assertions * remove a duplicate assertion * remove redundant assertion and min * rename set_start to advance_unchecked
2024-02-06get_vec_pos: use &self instead of &mut self (#670)Gravatar Brad Dunbar 1-3/+3
I can't see any reason that get_vec_pos needs a &mut self.
2024-02-06set_vec_pos does not need a second parameter (#672)Gravatar Brad Dunbar 1-13/+11
The second argument to `set_vec_pos` always contains the value of `self.data`. Let's just use `self.data` and remove the second parameter altogether.
2024-02-06Calculate original capacity only if necessary (#666)Gravatar Brad Dunbar 1-6/+3
We don't need the original capacity if the shared data is unique, so let's not calculate it until after that check.
2024-02-06Use sub instead of offset (#668)Gravatar Brad Dunbar 1-2/+2
We're always subtracting here, and we already have a usize, so `sub` seems like a more appropriate usage to me.
2024-02-06Restore commented tests (#665)Gravatar Brad Dunbar 1-38/+41
These seem to have been commented by accident in #298, and are still passing.
2024-01-31refactor: make parameter mut in From<Vec> (#667)Gravatar Brad Dunbar 1-2/+1
Instead of re-declaring `vec`, we can just use a mut parameter.
2024-01-28Remove unreachable else branch (#661)Gravatar Brad Dunbar 1-3/+1
2024-01-28Remove an unnecessary else branch (#662)Gravatar Brad Dunbar 1-2/+2
2024-01-28Remove unnecessary namespace qualifier (#660)Gravatar Brad Dunbar 2-3/+3
2024-01-19add `Bytes::is_unique` (#643)Gravatar Cyborus04 3-0/+84
2024-01-19BytesMut: Assert alignment of Shared (#652)Gravatar Brad Dunbar 1-0/+6
Back in #362, an assertion was added to ensure that the alignment of bytes::Shared is even so we can use the least significant bit as a flag. bytes_mut::Shared uses the same technique but has no such assertion so I've added one here.
2024-01-08Update CI config (#650)Gravatar Taiki Endo 4-30/+33
2024-01-08Update loom to 0.7 (#651)Gravatar Taiki Endo 1-1/+1