New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add conversion from Bytes to Vec<u8> #547
Add conversion from Bytes to Vec<u8> #547
Conversation
6a81b68
to
37b4146
Compare
CI/miri failed due to strict provenance being enabled and the bytes codebase uses integer-pointer conversions and vice versa. I also run miri locally with strict provenance and it succeeded with warning on integer-pointer cast. This PR itself does not add any integer-pointer conversion, so it should not block this PR from being merged. |
37b4146
to
94763c2
Compare
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Add new function `dealloc_shared` and call it instead of setting the underlying `Vec` contained in `Shared` to an empty Vec then `release_shared`. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Instead of reborrowing it as mutable reference, modify the first borrow to be mutable reference. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Call `release_shared` if `kind == KIND_ARC` and the shared is not unique. Also fixed reborrowing as mutable reference issue in `bytes_mut::shared_to_vec`. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
in `test_bytes.rs` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
94763c2
to
b43705f
Compare
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
instead of `&mut Shared` to avoid breaking stack borrow rules. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
As it is only used by `promotable_to_vec` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
just to be explicit Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Just to be explicit Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
until `is_unique()` returns `true`. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
To set the `ref_cnt` to `0` using `Ordering::AcqRel` if it is unique. Otherwise, it is equivalent to a `Ordering::Relaxed` load. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> Co-authored-by: Alice Ryhl <aliceryhl@google.com>
Fixed #427
This PR adds conversion for
Bytes
, which is parallel to #543, which adds conversion forBytesMut
.This PR supersedes #151
Signed-off-by: Jiahao XU Jiahao_XU@outlook.com