From a64b8dc5d0d7de2646b772e8b8d07b38fd49c041 Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Thu, 1 Aug 2024 13:10:57 +0200 Subject: [PATCH 1/2] chore: switch from slice-deque to its fork slice-ring-buffer slice-deque is unmaintained, "cargo test" doesn't run successfully anymore. the slice-ring-buffer fork is mentioned in https://github.com/gnzlbg/slice_deque/issues/94 --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 00d682b..e41e95c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,9 +14,9 @@ edition = "2021" memchr = "2.0" # `slice_deque` is only supported on platforms with virtual memory -[target.'cfg(any(unix, windows))'.dependencies.slice-deque] +[target.'cfg(any(unix, windows))'.dependencies.slice-ring-buffer] version = "0.3" optional = true [features] -default = ["slice-deque"] +default = ["slice-ring-buffer"] From 88582b0b81952454a7e7ab07418118db91ab8fd5 Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Thu, 1 Aug 2024 13:32:05 +0200 Subject: [PATCH 2/2] xx: half port to slice-ring-buffer --- Cargo.toml | 3 ++- src/buffer/slice_deque_buf.rs | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e41e95c..08a8036 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,5 @@ version = "0.3" optional = true [features] -default = ["slice-ring-buffer"] +default = ["slice-deque"] +slice-deque = ["dep:slice-ring-buffer"] diff --git a/src/buffer/slice_deque_buf.rs b/src/buffer/slice_deque_buf.rs index 91bcfec..94e54be 100644 --- a/src/buffer/slice_deque_buf.rs +++ b/src/buffer/slice_deque_buf.rs @@ -4,13 +4,14 @@ //! namely Windows, OS X and Linux. //! //! [`slice-deque`]: https://crates.io/crates/slice-deque -extern crate slice_deque; -use self::slice_deque::SliceDeque; +extern crate slice_ring_buffer; +use self::slice_ring_buffer::SliceRingBuffer; use std::cmp; +use std::mem::MaybeUninit; pub struct SliceDequeBuf { - deque: SliceDeque, + deque: SliceRingBuffer, } /// Move-free buffer utilizing the [`slice-deque`] crate. @@ -22,7 +23,7 @@ pub struct SliceDequeBuf { impl SliceDequeBuf { pub fn with_capacity(cap: usize) -> Self { SliceDequeBuf { - deque: SliceDeque::with_capacity(cap), + deque: SliceRingBuffer::with_capacity(cap), } } @@ -55,7 +56,7 @@ impl SliceDequeBuf { &mut self.deque } - pub unsafe fn write_buf(&mut self) -> &mut [u8] { + pub unsafe fn write_buf(&mut self) -> &mut [MaybeUninit] { self.deque.tail_head_slice() }