vip892766gma and GitHub
2256e6dc3e
chore: add safety comments on unsafe blocks ( #827 )
2026-05-19 13:11:51 -04:00
DaniPopes and GitHub
245adff079
Pass vtable data by value ( #826 )
2026-04-29 07:28:59 +02:00
Mai Thanh Minh and GitHub
00cc5ff2bd
Implement BytesMut::extend_from_within ( #818 )
2026-02-03 15:33:17 +01:00
Alice Ryhl
5b79d316c9
Merge tag 'v1.11.1'
2026-02-03 13:45:19 +00:00
Alice Ryhl and GitHub
d0293b0e35
Merge commit from fork
...
* Add repro for integer overflow
Signed-off-by: Alice Ryhl <[email protected] >
* Always check overflow in new_cap + offset
Signed-off-by: Alice Ryhl <[email protected] >
---------
Signed-off-by: Alice Ryhl <[email protected] >
2026-02-03 14:40:22 +01:00
Petros Angelatos and GitHub
804ee6d039
Make try_unsplit method public ( #746 )
2026-01-23 11:45:15 +01:00
Paolo Barbolini and GitHub
94e42915a9
Document that BytesMut::{reserve,try_reserve} doesn't preserve unused capacity ( #808 )
2025-11-28 10:02:34 +01:00
discord9 and GitHub
60cbb776f2
fix: BytesMut only reuse if src has remaining ( #803 )
...
Signed-off-by: discord9 <[email protected] >
2025-11-14 10:52:50 +01:00
Stepan Koltsov and GitHub
4b53a29eb2
Tweak BytesMut::remaining_mut ( #795 )
2025-08-20 11:57:49 +02:00
Stepan Koltsov and GitHub
016fdbdc7a
Reserve capacity in BytesMut::put ( #794 )
2025-08-19 12:50:38 +02:00
Stepan Koltsov and GitHub
ef7f25736c
Specialize BytesMut::put::<Bytes> ( #793 )
2025-08-14 08:55:18 +00:00
Taiki Endo and GitHub
8b4f54d0f3
Ignore BytesMut::freeze doctest on wasm ( #790 )
2025-08-10 19:34:43 +09:00
Paolo Barbolini and GitHub
16132ad259
Fix latest clippy warnings ( #787 )
2025-07-16 10:53:50 +02:00
Paolo Barbolini and GitHub
3e44f88f5f
Bump MSRV to 1.57 ( #788 )
2025-07-16 10:33:07 +02:00
Scott Lamb and GitHub
141cbc22cb
Rename Vtable::to_* -> Vtable::into_* ( #776 )
2025-03-07 13:58:07 +00:00
hpenne and GitHub
3ab876fee6
Try get methods for Buf trait ( #753 )
2025-01-21 13:41:42 +01: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
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
Alice Ryhl
f8c7b574c0
Merge 'v1.6.1' into 'master' ( #721 )
2024-07-13 09:51:48 +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
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
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
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
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
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
536db06f16
Use ManuallyDrop instead of mem::forget ( #675 )
2024-03-14 14:40:03 +01:00
Brad Dunbar and GitHub
7968f6f83d
Remove redundant reserve call ( #674 )
2024-03-04 09:04:40 +01: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
Brad Dunbar and GitHub
f586ffc525
set_vec_pos does not need a second parameter ( #672 )
...
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-06 11:03:37 -08:00
Brad Dunbar and GitHub
c6972d6132
Calculate original capacity only if necessary ( #666 )
...
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-06 10:46:49 -08:00
Brad Dunbar and GitHub
47e83056f2
Use sub instead of offset ( #668 )
...
We're always subtracting here, and we already have a usize, so `sub`
seems like a more appropriate usage to me.
2024-02-06 10:41:44 -08:00
Brad Dunbar and GitHub
8bcac21cb4
Restore commented tests ( #665 )
...
These seem to have been commented by accident in #298 , and are still
passing.
2024-02-06 10:17:01 -08:00
Brad Dunbar and GitHub
e24587dd61
Remove unreachable else branch ( #661 )
2024-01-28 15:30:30 +03:30
Brad Dunbar and GitHub
9257a6ea08
Remove an unnecessary else branch ( #662 )
2024-01-28 14:20:56 +03:30
Brad Dunbar and GitHub
0ba3b4c4cd
Remove unnecessary namespace qualifier ( #660 )
2024-01-28 14:07:11 +03:30
Cyborus04 and GitHub
0864aea970
add Bytes::is_unique ( #643 )
2024-01-19 23:59:30 +01:00
Brad Dunbar and GitHub
abb4a2e66c
BytesMut: Assert alignment of Shared ( #652 )
...
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-19 11:08:27 +01:00
Gabriel Goller and GitHub
72cbb92e0e
docs: fix broken links ( #639 )
...
Fixed a few broken links and converted a lot of them from the
html-link to intra-doc links.
2023-11-16 06:24:21 -05:00
Alice Ryhl and GitHub
fd9243f9e2
Various cleanup ( #635 )
2023-10-02 15:40:02 +02:00
mxsm and GitHub
a4e16a552b
docs: fix some spelling mistakes ( #633 )
2023-09-25 10:47:02 +02:00
Lucas Kent and GitHub
a14ef4617c
Move comment to correct constant ( #629 )
2023-09-11 11:12:11 +02:00
Michal Nazarewicz and GitHub
99a27542a0
Add a safe way to create UninitSlice from slices ( #598 )
...
Introduce UninitSlice::from_slice and UninitSlice::from_uninit_slice
methods which safely create Uninit slice from provided slice of maybe
uninitialised or initialised memory.
In addition, add `From<&mut [T]>` implementations (for `T=u8` and
`T=MaybeUninit<u8>`) which do conversion from slice to UninitSlice.
Closes : #552
2023-02-09 17:24:23 +01:00
Paa Kojo Samanpa and GitHub
74b04c7aae
Mark BytesMut::extend_from_slice as inline ( #595 )
...
This function can be hot in applications that do a lot of encoding. Ideally would do the same for `<BytesMut as BufMut>::put_slice` and `<BytesMut as BufMut::put_u8`.
2023-02-04 20:16:41 +01:00