add `Bytes::is_unique`
Closes #533

This adds the `is_unique` method to `Bytes`. It checks reference count when backed by (effectively) `Arc<Vec<u8>>`, returns true when backed by a vec, and returns false for static slices
I would like to be able to tell if a `Bytes` object is the unique reference to the underlying data. The usecase is a cache, where I want to be able to evict an object from the cache only if it is not used elsewhere — otherwise, removing it from the cache would not free up any memory, and if the object was requested again later, it would have to be fetched (in my case, thru a network request), and duplicated in memory if the original copy is still around.
Add a way to tell if `Bytes` is unique
diff --git a/src/bytes.rs b/src/bytes.rs
index 9fed3d287..9eda9f463 100644
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -112,6 +112,8 @@ pub(crate) struct Vtable {
     ///
     /// takes `Bytes` to value
     pub to_vec: unsafe fn(&AtomicPtr<()>, *const u8, usize) -> Vec<u8>,
+    /// fn(data)
+    pub is_unique: unsafe fn(&AtomicPtr<()>) -> bool,
     /// fn(data, ptr, len)
     pub drop: unsafe fn(&mut AtomicPtr<()>, *const u8, usize),
 }
@@ -208,6 +210,28 @@ impl Bytes {
         self.len == 0
     }
 
+    /// Returns true if this is the only reference to the data.
+    ///
+    /// Always returns false if the data is backed by a static slice.
+    ///
+    /// The result of this method may be invalidated immediately if another
+    /// thread clones this value while this is being called. Ensure you have
+    /// unique access to this value (`&mut Bytes`) first if you need to be
+    /// certain the result is valid (i.e. for safety reasons)
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let a = Bytes::from(vec![1, 2, 3]);
+    /// assert!(a.is_unique());
+    /// let b = a.clone();
+    /// assert!(!a.is_unique());
+    /// ```
+    pub fn is_unique(&self) -> bool {
+        unsafe { (self.vtable.is_unique)(&self.data) }
+    }
+
     /// Creates `Bytes` instance from slice, by copying it.
     pub fn copy_from_slice(data: &[u8]) -> Self {
         data.to_vec().into()
@@ -898,6 +922,7 @@ impl fmt::Debug for Vtable {
 const STATIC_VTABLE: Vtable = Vtable {
     clone: static_clone,
     to_vec: static_to_vec,
+    is_unique: static_is_unique,
     drop: static_drop,
 };
 
@@ -911,6 +936,10 @@ unsafe fn static_to_vec(_: &AtomicPtr<()>, ptr: *const u8, len: usize) -> Vec<u8
     slice.to_vec()
 }
 
+fn static_is_unique(_: &AtomicPtr<()>) -> bool {
+    false
+}
+
 unsafe fn static_drop(_: &mut AtomicPtr<()>, _: *const u8, _: usize) {
     // nothing to drop for &'static [u8]
 }
@@ -920,12 +949,14 @@ unsafe fn static_drop(_: &mut AtomicPtr<()>, _: *const u8, _: usize) {
 static PROMOTABLE_EVEN_VTABLE: Vtable = Vtable {
     clone: promotable_even_clone,
     to_vec: promotable_even_to_vec,
+    is_unique: promotable_is_unique,
     drop: promotable_even_drop,
 };
 
 static PROMOTABLE_ODD_VTABLE: Vtable = Vtable {
     clone: promotable_odd_clone,
     to_vec: promotable_odd_to_vec,
+    is_unique: promotable_is_unique,
     drop: promotable_odd_drop,
 };
 
@@ -1020,6 +1051,18 @@ unsafe fn promotable_odd_drop(data: &mut AtomicPtr<()>, ptr: *const u8, len: usi
     });
 }
 
+unsafe fn promotable_is_unique(data: &AtomicPtr<()>) -> bool {
+    let shared = data.load(Ordering::Acquire);
+    let kind = shared as usize & KIND_MASK;
+
+    if kind == KIND_ARC {
+        let ref_cnt = (*shared.cast::<Shared>()).ref_cnt.load(Ordering::Relaxed);
+        ref_cnt == 1
+    } else {
+        true
+    }
+}
+
 unsafe fn free_boxed_slice(buf: *mut u8, offset: *const u8, len: usize) {
     let cap = (offset as usize - buf as usize) + len;
     dealloc(buf, Layout::from_size_align(cap, 1).unwrap())
@@ -1049,6 +1092,7 @@ const _: [(); 0 - mem::align_of::<Shared>() % 2] = []; // Assert that the alignm
 static SHARED_VTABLE: Vtable = Vtable {
     clone: shared_clone,
     to_vec: shared_to_vec,
+    is_unique: shared_is_unique,
     drop: shared_drop,
 };
 
@@ -1094,6 +1138,12 @@ unsafe fn shared_to_vec(data: &AtomicPtr<()>, ptr: *const u8, len: usize) -> Vec
     shared_to_vec_impl(data.load(Ordering::Relaxed).cast(), ptr, len)
 }
 
+pub(crate) unsafe fn shared_is_unique(data: &AtomicPtr<()>) -> bool {
+    let shared = data.load(Ordering::Acquire);
+    let ref_cnt = (*shared.cast::<Shared>()).ref_cnt.load(Ordering::Relaxed);
+    ref_cnt == 1
+}
+
 unsafe fn shared_drop(data: &mut AtomicPtr<()>, _ptr: *const u8, _len: usize) {
     data.with_mut(|shared| {
         release_shared(shared.cast());
diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs
index 57fd33e4b..cb9687d9d 100644
--- a/src/bytes_mut.rs
+++ b/src/bytes_mut.rs
@@ -1702,6 +1702,7 @@ unsafe fn rebuild_vec(ptr: *mut u8, mut len: usize, mut cap: usize, off: usize)
 static SHARED_VTABLE: Vtable = Vtable {
     clone: shared_v_clone,
     to_vec: shared_v_to_vec,
+    is_unique: crate::bytes::shared_is_unique,
     drop: shared_v_drop,
 };
 

diff --git a/tests/test_bytes.rs b/tests/test_bytes.rs
index 5ec60a5b0..76adfdbf4 100644
--- a/tests/test_bytes.rs
+++ b/tests/test_bytes.rs
@@ -1208,3 +1208,36 @@ fn test_bytes_capacity_len() {
         }
     }
 }
+
+#[test]
+fn static_is_unique() {
+    let b = Bytes::from_static(LONG);
+    assert!(!b.is_unique());
+}
+
+#[test]
+fn vec_is_unique() {
+    let v: Vec<u8> = LONG.to_vec();
+    let b = Bytes::from(v);
+    assert!(b.is_unique());
+}
+
+#[test]
+fn arc_is_unique() {
+    let v: Vec<u8> = LONG.to_vec();
+    let b = Bytes::from(v);
+    let c = b.clone();
+    assert!(!b.is_unique());
+    drop(c);
+    assert!(b.is_unique());
+}
+
+#[test]
+fn shared_is_unique() {
+    let v: Vec<u8> = LONG.to_vec();
+    let b = Bytes::from(v);
+    let c = b.clone();
+    assert!(!c.is_unique());
+    drop(b);
+    assert!(c.is_unique());
+}

{"test_maybe_uninit_buf_mut_small": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_advance_arc": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "vectored_read": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_in_arc_nonunique_does_not_overallocate": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_clone": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_empty_other": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_advance": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "chain_get_bytes": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "copy_to_bytes_less": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_split_off": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_vec_recycling": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "take_copy_to_bytes": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "fmt": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "buf_read": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "vec_is_unique": {"run": "NONE", "test": "NONE", "fix": "PASS"}, "test_bufs_vec": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "from_slice": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "len": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_in_arc_unique_does_not_overallocate": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "slice_ref_empty_subslice": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "from_iter_no_size_hint": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_with_capacity_but_empty": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_truncate_and_advance": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_vec_as_mut_buf": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_maybe_uninit_buf_mut_large": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "slice": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_arc_different": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_get_u16": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_split_to": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_growth": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_deref_bufmut_forwards": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "writing_chained": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "iterating_two_bufs": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_vec_deque": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "sanity_check_odd_allocator": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_layout": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "arc_is_unique": {"run": "NONE", "test": "NONE", "fix": "PASS"}, "index": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_get_u8": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_to_1": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "extend_mut_from_bytes": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_in_arc_unique_does_not_overallocate_after_split": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_put_u8": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "extend_from_slice_mut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_off_to_loop": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_slice_buf_mut_large": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_clone_unique": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "from_static": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "box_slice_empty": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_put_int_le": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_put_u16": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_into_vec": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_mut_conversion": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_to_2": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "shared_is_unique": {"run": "NONE", "test": "NONE", "fix": "PASS"}, "partial_eq_bytesmut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "slice_ref_not_an_empty_subset": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_clone_drop": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_truncate": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_into_vec": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_in_arc_unique_doubles": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_truncate_arc": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "long_take": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "slice_ref_empty": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_clone_shared": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_truncate": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_vec_conversion": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "chain_overflow_remaining_mut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_empty_other_keeps_capacity": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "fmt_write": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "advance_bytes_mut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_max_original_capacity_value": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_allocates_at_least_original_capacity": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "extend_mut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "extend_mut_without_size_hint": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_two_split_offs": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_from_vec_drop": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_off": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_capacity_len": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_put_int": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "collect_two_bufs": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "slice_ref_works": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_arc_non_contiguous": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "fns_defined_for_bytes_mut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_deref_buf_forwards": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "read": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "advance_static": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_in_arc_unique_does_not_overallocate_after_multiple_splits": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_buf_mut_advance": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_into_vec_promotable_even": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "iter_len": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_vec_put_bytes": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "static_is_unique": {"run": "NONE", "test": "NONE", "fix": "PASS"}, "advance_vec": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "stress": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_slice_buf_mut_small": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_fresh_cursor_vec": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_other_keeps_capacity": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "truncate": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_off_to_at_gt_len": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "empty_slice_ref_not_an_empty_subset": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_put_bytes": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "chain_growing_buffer": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bounds": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_off_uninitialized": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_buf_mut_reuse_when_fully_consumed": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_basic": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "empty_iter_len": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_shared_reuse": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_advance": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_convert": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_empty_self": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"test_maybe_uninit_buf_mut_small": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_advance_arc": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "vectored_read": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_in_arc_nonunique_does_not_overallocate": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_clone": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_empty_other": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_advance": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "chain_get_bytes": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "copy_to_bytes_less": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_split_off": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_vec_recycling": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "take_copy_to_bytes": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "fmt": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "buf_read": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "vec_is_unique": {"run": "NONE", "test": "NONE", "fix": "PASS"}, "test_bufs_vec": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "from_slice": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "len": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_in_arc_unique_does_not_overallocate": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "slice_ref_empty_subslice": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "from_iter_no_size_hint": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_with_capacity_but_empty": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_truncate_and_advance": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_vec_as_mut_buf": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_maybe_uninit_buf_mut_large": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "slice": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_arc_different": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_get_u16": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_split_to": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_growth": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_deref_bufmut_forwards": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "writing_chained": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "iterating_two_bufs": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_vec_deque": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "sanity_check_odd_allocator": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_layout": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "arc_is_unique": {"run": "NONE", "test": "NONE", "fix": "PASS"}, "index": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_get_u8": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_to_1": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "extend_mut_from_bytes": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_in_arc_unique_does_not_overallocate_after_split": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_put_u8": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "extend_from_slice_mut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_off_to_loop": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_slice_buf_mut_large": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_clone_unique": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "from_static": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "box_slice_empty": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_put_int_le": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_put_u16": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_into_vec": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_mut_conversion": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_to_2": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "shared_is_unique": {"run": "NONE", "test": "NONE", "fix": "PASS"}, "partial_eq_bytesmut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "slice_ref_not_an_empty_subset": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_clone_drop": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_truncate": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_into_vec": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_in_arc_unique_doubles": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_truncate_arc": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "long_take": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "slice_ref_empty": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_clone_shared": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "freeze_after_truncate": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_vec_conversion": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "chain_overflow_remaining_mut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_empty_other_keeps_capacity": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "fmt_write": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "advance_bytes_mut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_max_original_capacity_value": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_allocates_at_least_original_capacity": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "extend_mut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "extend_mut_without_size_hint": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_two_split_offs": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_from_vec_drop": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_off": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_capacity_len": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_put_int": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "collect_two_bufs": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "slice_ref_works": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_arc_non_contiguous": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "fns_defined_for_bytes_mut": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_deref_buf_forwards": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "read": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "advance_static": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_in_arc_unique_does_not_overallocate_after_multiple_splits": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_buf_mut_advance": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_into_vec_promotable_even": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "iter_len": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_vec_put_bytes": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "static_is_unique": {"run": "NONE", "test": "NONE", "fix": "PASS"}, "advance_vec": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "stress": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_slice_buf_mut_small": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_fresh_cursor_vec": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_other_keeps_capacity": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "truncate": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_off_to_at_gt_len": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "empty_slice_ref_not_an_empty_subset": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_put_bytes": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "chain_growing_buffer": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bounds": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "split_off_uninitialized": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_buf_mut_reuse_when_fully_consumed": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_basic": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "empty_iter_len": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_shared_reuse": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "test_bytes_advance": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "reserve_convert": {"run": "PASS", "test": "NONE", "fix": "PASS"}, "bytes_mut_unsplit_empty_self": {"run": "PASS", "test": "NONE", "fix": "PASS"}}
{"passed_count": 108, "failed_count": 0, "skipped_count": 0, "passed_tests": ["test_maybe_uninit_buf_mut_small", "freeze_after_advance_arc", "vectored_read", "reserve_in_arc_nonunique_does_not_overallocate", "test_clone", "copy_to_bytes_less", "freeze_after_split_off", "reserve_vec_recycling", "fmt", "buf_read", "from_slice", "len", "slice_ref_empty_subslice", "from_iter_no_size_hint", "bytes_with_capacity_but_empty", "test_vec_as_mut_buf", "bytes_mut_unsplit_arc_different", "test_get_u16", "freeze_after_split_to", "reserve_growth", "test_vec_deque", "extend_from_slice_mut", "box_slice_empty", "test_put_u16", "split_to_2", "partial_eq_bytesmut", "slice_ref_not_an_empty_subset", "test_bytes_truncate", "freeze_clone_shared", "test_bytes_vec_conversion", "advance_bytes_mut", "reserve_max_original_capacity_value", "extend_mut_without_size_hint", "test_bytes_from_vec_drop", "slice_ref_works", "bytes_mut_unsplit_arc_non_contiguous", "fns_defined_for_bytes_mut", "test_deref_buf_forwards", "read", "advance_static", "reserve_in_arc_unique_does_not_overallocate_after_multiple_splits", "bytes_buf_mut_advance", "test_bytes_into_vec_promotable_even", "iter_len", "test_fresh_cursor_vec", "split_off_to_at_gt_len", "empty_slice_ref_not_an_empty_subset", "bytes_put_bytes", "split_off_uninitialized", "bytes_buf_mut_reuse_when_fully_consumed", "bytes_mut_unsplit_basic", "reserve_shared_reuse", "test_bytes_advance", "bytes_mut_unsplit_empty_self", "bytes_mut_unsplit_empty_other", "freeze_after_advance", "chain_get_bytes", "take_copy_to_bytes", "test_bufs_vec", "reserve_in_arc_unique_does_not_overallocate", "test_bytes_truncate_and_advance", "test_maybe_uninit_buf_mut_large", "slice", "test_deref_bufmut_forwards", "writing_chained", "iterating_two_bufs", "sanity_check_odd_allocator", "test_layout", "index", "test_get_u8", "split_to_1", "extend_mut_from_bytes", "reserve_in_arc_unique_does_not_overallocate_after_split", "test_put_u8", "split_off_to_loop", "test_slice_buf_mut_large", "freeze_clone_unique", "from_static", "test_put_int_le", "bytes_into_vec", "test_bytes_mut_conversion", "test_bytes_clone_drop", "test_bytes_into_vec", "reserve_in_arc_unique_doubles", "freeze_after_truncate_arc", "long_take", "slice_ref_empty", "freeze_after_truncate", "chain_overflow_remaining_mut", "bytes_mut_unsplit_empty_other_keeps_capacity", "fmt_write", "reserve_allocates_at_least_original_capacity", "extend_mut", "bytes_mut_unsplit_two_split_offs", "split_off", "test_bytes_capacity_len", "test_put_int", "collect_two_bufs", "test_vec_put_bytes", "advance_vec", "stress", "test_slice_buf_mut_small", "bytes_mut_unsplit_other_keeps_capacity", "truncate", "chain_growing_buffer", "test_bounds", "empty_iter_len", "reserve_convert"], "failed_tests": [], "skipped_tests": []}
{"passed_count": 0, "failed_count": 0, "skipped_count": 0, "passed_tests": [], "failed_tests": [], "skipped_tests": []}
{"passed_count": 112, "failed_count": 0, "skipped_count": 0, "passed_tests": ["test_maybe_uninit_buf_mut_small", "freeze_after_advance_arc", "vectored_read", "reserve_in_arc_nonunique_does_not_overallocate", "test_clone", "copy_to_bytes_less", "freeze_after_split_off", "reserve_vec_recycling", "fmt", "buf_read", "vec_is_unique", "from_slice", "len", "slice_ref_empty_subslice", "from_iter_no_size_hint", "bytes_with_capacity_but_empty", "test_vec_as_mut_buf", "bytes_mut_unsplit_arc_different", "test_get_u16", "freeze_after_split_to", "reserve_growth", "test_vec_deque", "arc_is_unique", "extend_from_slice_mut", "box_slice_empty", "shared_is_unique", "test_put_u16", "split_to_2", "partial_eq_bytesmut", "slice_ref_not_an_empty_subset", "test_bytes_truncate", "freeze_clone_shared", "test_bytes_vec_conversion", "advance_bytes_mut", "reserve_max_original_capacity_value", "extend_mut_without_size_hint", "test_bytes_from_vec_drop", "slice_ref_works", "bytes_mut_unsplit_arc_non_contiguous", "fns_defined_for_bytes_mut", "test_deref_buf_forwards", "read", "advance_static", "reserve_in_arc_unique_does_not_overallocate_after_multiple_splits", "bytes_buf_mut_advance", "test_bytes_into_vec_promotable_even", "iter_len", "test_fresh_cursor_vec", "split_off_to_at_gt_len", "empty_slice_ref_not_an_empty_subset", "bytes_put_bytes", "split_off_uninitialized", "bytes_buf_mut_reuse_when_fully_consumed", "bytes_mut_unsplit_basic", "reserve_shared_reuse", "test_bytes_advance", "bytes_mut_unsplit_empty_self", "bytes_mut_unsplit_empty_other", "freeze_after_advance", "chain_get_bytes", "take_copy_to_bytes", "test_bufs_vec", "reserve_in_arc_unique_does_not_overallocate", "test_bytes_truncate_and_advance", "test_maybe_uninit_buf_mut_large", "slice", "test_deref_bufmut_forwards", "writing_chained", "iterating_two_bufs", "sanity_check_odd_allocator", "test_layout", "index", "test_get_u8", "split_to_1", "extend_mut_from_bytes", "reserve_in_arc_unique_does_not_overallocate_after_split", "test_put_u8", "split_off_to_loop", "test_slice_buf_mut_large", "freeze_clone_unique", "from_static", "test_put_int_le", "bytes_into_vec", "test_bytes_mut_conversion", "test_bytes_clone_drop", "test_bytes_into_vec", "reserve_in_arc_unique_doubles", "freeze_after_truncate_arc", "long_take", "slice_ref_empty", "freeze_after_truncate", "chain_overflow_remaining_mut", "bytes_mut_unsplit_empty_other_keeps_capacity", "fmt_write", "reserve_allocates_at_least_original_capacity", "extend_mut", "bytes_mut_unsplit_two_split_offs", "split_off", "test_bytes_capacity_len", "test_put_int", "collect_two_bufs", "static_is_unique", "test_vec_put_bytes", "advance_vec", "stress", "test_slice_buf_mut_small", "bytes_mut_unsplit_other_keeps_capacity", "truncate", "chain_growing_buffer", "test_bounds", "empty_iter_len", "reserve_convert"], "failed_tests": [], "skipped_tests": []}