Alice Ryhl and GitHub
103d7bf9e0
Remove incorrect guarantee for chunks_vectored ( #754 )
2025-01-10 23:13:52 +01:00
Paolo Barbolini and GitHub
16cc574fea
Implement Buf::chunks_vectored for VecDeque<u8> ( #708 )
2025-01-10 14:40:12 +01:00
Paolo Barbolini and GitHub
0e9e4fc2f1
Expand Buf tests ( #747 )
2025-01-09 17:13:47 +01:00
Alice Ryhl and GitHub
f7072c9267
Run tests under panic=abort ( #749 )
2024-12-10 22:30:27 +01:00
Kyle Barron and GitHub
d0a14deeb5
chore: prepare bytes v1.9.0 ( #748 )
v1.9.0
2024-11-28 13:43:45 +01:00
Leonid Logvinov and GitHub
54f1c26f69
Rename hex_impl! to fmt_impl! and reuse it for fmt::Debug ( #743 )
2024-11-08 10:23:02 +01:00
Paolo Barbolini and GitHub
4cd8969e85
Replace BufMut::put with BufMut::put_slice in Writer impl ( #745 )
2024-11-01 18:22:07 +00:00
katelyn martin and GitHub
2d996a2b41
Fix typo in Buf::chunk() comment ( #744 )
2024-11-01 14:46:09 +00:00
Adam Cimarosti and GitHub
30ee8e9cba
Add Bytes::from_owner ( #742 )
2024-10-29 13:18:03 +01:00
Alice Ryhl and GitHub
c45697ce42
chore: prepare bytes v1.8.0 ( #741 )
v1.8.0
2024-10-21 21:54:34 +02:00
Alice Ryhl and GitHub
0ac54ca706
Guarantee address in split_off/split_to for empty slices ( #740 )
...
Signed-off-by: Alice Ryhl <[email protected] >
2024-10-18 19:46:49 +02:00
Paolo Barbolini and GitHub
d7c1d658d9
chore: prepare bytes v1.7.2 ( #736 )
v1.7.2
2024-09-18 07:39:32 +02:00
Taiki Endo and GitHub
ac46ebdd46
ci: update nightly to nightly-2024-09-15 ( #734 )
2024-09-17 11:02:45 -04:00
Paolo Barbolini and GitHub
79fb85323c
fix: apply sign extension when decoding int ( #732 )
...
Closes #730
2024-08-30 08:20:29 -04:00
Paolo Barbolini and GitHub
291df5acc9
Fix double spaces in comments and doc comments ( #731 )
2024-08-19 10:19:35 +02:00
Cameron Bytheway and GitHub
ed7d5ff39e
test: ensure BytesMut::advance reduces capacity ( #728 )
2024-08-02 19:07:45 +00:00
Alice Ryhl and GitHub
dc4fb3e8f4
chore: prepare bytes v1.7.1 ( #727 )
v1.7.1
2024-08-01 22:55:24 +02:00
Alice Ryhl and GitHub
f488be48d0
Revert "Reuse capacity when possible in <BytesMut as Buf>::advance impl" ( #726 )
...
This reverts commit baa5053572 .
2024-08-01 22:38:17 +02:00
Motoyuki Kimura and GitHub
03fdde9dcf
chore: prepare v1.7.0 ( #724 )
v1.7.0
2024-07-31 13:33:47 +02:00
Alice Ryhl
f8c7b574c0
Merge 'v1.6.1' into 'master' ( #721 )
2024-07-13 09:51:48 +02:00
Alice Ryhl and GitHub
fd13c7dcdb
chore: prepare bytes v1.6.1 ( #720 )
v1.6.1
2024-07-13 09:45:33 +02:00
Emily Crandall Fleischman and GitHub
6b4b0eda29
Fix Bytes::is_unique when created from shared BytesMut ( #718 )
...
The `is_unique` entry in the vtable for `Bytes` created from a shared
`BytesMut` just called the `shared_is_unique` function from the `bytes`
module. However, that function dereferences the `data` argument` as
`bytes::Shared`, but the actual underlying type is `bytes_mut::Shared`.
2024-07-13 01:09:46 +02:00
EXPLOSION and GitHub
9965a04b56
Remove unnecessary file ( #719 )
2024-07-10 19:08:47 +09:00
vvvviiv and GitHub
3443ca5a0b
docs: clarify the behavior of Buf::chunk ( #717 )
2024-07-09 14:13:09 +02:00
Sebastian Hahn and GitHub
8cc940779f
Allow reclaiming the current allocation ( #686 )
2024-06-28 14:26:32 +02:00
Paolo Barbolini and GitHub
7a5154ba8b
Clarify how BytesMut::zeroed works and advantages to manual impl ( #714 )
2024-06-21 14:07:25 +02:00
Anthony Ramine and GitHub
fa1daac3ae
Change Bytes::make_mut to impl From<Bytes> for BytesMut ( closes #709 ) ( #710 )
...
<Arc<T>>::make_mut returns a &mut T, such an API is doable for Bytes too
and thus we should reserve Bytes::make_mut for that.
Furthermore, it would be helpful to use From<Bytes> as a trait bound
in some cases with other traits such as Hyper's body trait, where Hyper
gives you Bytes values.
Finally, making it impl From<Bytes> for BytesMut means the API is more
easily discoverable as it appears on both Bytes and BytesMut.
2024-05-28 10:14:02 +02:00
Paolo Barbolini and GitHub
caf520ac7f
Fix iter tests to use the actual bytes IntoIter instead of std ( #707 )
2024-05-19 15:28:03 -04:00
Brad Dunbar and GitHub
4950c50376
Offset from ( #705 )
2024-05-11 19:41:50 +02:00
Émile Fugulin and GitHub
86694b0564
Add zero-copy make_mut ( #695 )
2024-05-05 17:58:00 +02:00
Alice Ryhl and GitHub
0c17e99283
ci: silence unexpected-cfgs warnings due to #[cfg(loom)] ( #703 )
2024-05-05 14:19:18 +02:00
Alice Ryhl and GitHub
cb7f8449b5
Tweak clear and truncate length modifications ( #700 )
2024-04-26 09:24:05 +02:00
Paolo Barbolini and GitHub
a8806c2457
Improve BytesMut::split suggestion ( #699 )
2024-04-25 10:43:15 +02:00
Paolo Barbolini and GitHub
baa5053572
Reuse capacity when possible in <BytesMut as Buf>::advance impl ( #698 )
2024-04-25 09:08:16 +02:00
Brad Dunbar and GitHub
ce09d7d358
Bytes::split_off - check fast path first ( #693 )
...
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-24 08:23:39 -04:00
9d3ec1cffb
Resize refactor ( #696 )
...
* 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 <[email protected] >
---------
Co-authored-by: Alice Ryhl <[email protected] >
2024-04-24 05:49:53 -04:00
Brad Dunbar and GitHub
4e2c9c065a
Truncate tweaks ( #694 )
2024-04-17 11:27:00 +02:00
Joseph Perez and GitHub
327615e5d4
test(benches): encloses bytes into test::black_box for clone benches ( #691 )
...
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-11 11:45:18 +02:00
tison and GitHub
b5fbfc3edb
perf: improve Bytes::copy_to_bytes ( #688 )
...
Signed-off-by: tison <[email protected] >
2024-04-10 16:45:31 +02:00
Brad Dunbar and GitHub
4eb62b912a
Bytes::split_to - check fast path first ( #689 )
...
If `at == self.len()` then we already know `at <= self.len()`. If
`at == 0`, it can't be greater than `self.len()`.
2024-04-10 10:09:09 +02:00
Brad Dunbar and GitHub
e4af48633c
Don't set len in BytesMut::reserve ( #682 )
...
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-09 14:35:54 +02:00
Brad Dunbar and GitHub
0d4cc7ffed
Bytes: Use ManuallyDrop instead of mem::forget ( #678 )
2024-04-08 17:05:04 +02:00
Brad Dunbar and GitHub
ce8d8a0a02
chore: prepare bytes v1.6.0 ( #681 )
v1.6.0
2024-03-22 20:55:20 +01:00
Brad Dunbar and GitHub
536db06f16
Use ManuallyDrop instead of mem::forget ( #675 )
2024-03-14 14:40:03 +01:00
Brad Dunbar and GitHub
ca004117f8
Remove commented tests for Bytes::unsplit ( #677 )
...
Bytes doesn't have an unsplit method anymore. We can always retrieve
these from git history if necessary.
2024-03-04 09:05:00 +01:00
Brad Dunbar and GitHub
7968f6f83d
Remove redundant reserve call ( #674 )
2024-03-04 09:04:40 +01:00
Brad Dunbar and GitHub
c5fae00c76
copy_to_bytes: Add panic section to docs ( #676 )
...
Fixes #454 .
2024-03-03 22:59:30 +09:00
Brad Dunbar and GitHub
99584cc10d
Use Iterator from the prelude ( #673 )
...
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-03-03 00:40:17 +09:00
Brad Dunbar and GitHub
46289278f5
Refactor split_at/split_to ( #663 )
...
* 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-23 14:22:58 -08:00
Brad Dunbar and GitHub
1bcd2129d1
get_vec_pos: use &self instead of &mut self ( #670 )
...
I can't see any reason that get_vec_pos needs a &mut self.
2024-02-06 17:34:30 -05:00