From 919093d4eae5135e3badf0b285d4bf3a9e8987ca Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Sun, 12 Jun 2022 11:30:20 +0200 Subject: [PATCH 1/4] `array_map` features is on stable rust: - Cargo - add rust_version - lib - Remove doc comment for stabilization --- Cargo.toml | 4 +++- src/lib.rs | 8 +------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 849cb52..bdfaaaf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,9 +8,11 @@ categories = ["data-structures", "no-std"] documentation = "https://docs.rs/holodeque" repository = "https://github.com/dataphract/holodeque" readme = "README.md" -version = "0.2.0" # if changed, html_root_url must also be changed! +version = "0.2.1" # if changed, html_root_url must also be changed! edition = "2018" +rust_version = "1.55.0" + [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] diff --git a/src/lib.rs b/src/lib.rs index bc07153..b1bee64 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,11 +3,6 @@ //! This crate provides [`ArrayDeque`] and [`SliceDeque`], fixed-size ring //! buffers with interfaces similar to the standard library's [`VecDeque`]. //! -//! `holodeque` makes use of the unstable [`array_map`] feature to provide -//! `Default` initialization of arbitrarily-sized arrays. As a result, **a -//! `nightly` compiler is required until this feature is stabilized**. See the -//! [tracking issue] for its current status. -//! //! [`VecDeque`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html //! [`array_map`]: https://doc.rust-lang.org/unstable-book/library-features/array-map.html //! [tracking issue]: https://github.com/rust-lang/rust/issues/75243 @@ -84,11 +79,10 @@ //! [`MaybeUninit`]: https://doc.rust-lang.org/core/mem/union.MaybeUninit.html //! [`tinyvec`]: https://docs.rs/tinyvec -#![feature(array_map)] #![forbid(unsafe_code)] #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] -#![doc(html_root_url = "https://docs.rs/holodeque/0.2.0")] +#![doc(html_root_url = "https://docs.rs/holodeque/0.2.1")] pub mod array_deque; mod meta; From 35c6696f907ce6e25d1c7e4e96a1993d342d5794 Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Mon, 13 Jun 2022 15:42:58 +0200 Subject: [PATCH 2/4] ArrayDeque - derive Copy --- src/array_deque.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/array_deque.rs b/src/array_deque.rs index 224ba96..ced6f90 100644 --- a/src/array_deque.rs +++ b/src/array_deque.rs @@ -5,7 +5,7 @@ use crate::{ BaseDeque, CapacityError, DequeDrain, DequeIter, }; -#[derive(Clone, Debug)] +#[derive(Clone, Copy, Debug)] pub(crate) struct ArrayMeta { layout: MetaLayout, } @@ -34,7 +34,7 @@ impl Meta for ArrayMeta { /// All values are stored inline; that is, the size of of `ArrayDeque` is /// *at least* `size_of::<[T; N]>()`, regardless of the number of elements /// currently stored in the deque. -#[derive(Clone, Debug)] +#[derive(Clone, Copy, Debug)] pub struct ArrayDeque where T: Default, From 8e77d758cb0cd44ada5bd0e08535d938a629f773 Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Mon, 13 Jun 2022 19:36:15 +0200 Subject: [PATCH 3/4] remove other reference of array_map --- README.md | 7 ------- src/lib.rs | 2 -- 2 files changed, 9 deletions(-) diff --git a/README.md b/README.md index 9564fa5..fe60563 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,6 @@ Array- and slice-backed double-ended queues in 100% safe Rust. This crate provides `ArrayDeque` and `SliceDeque`, fixed-size ring buffers with interfaces similar to the standard library's `VecDeque`. -`holodeque` makes use of the unstable `array_map` feature to provide `Default` -initialization of arbitrarily-sized arrays. As a result, **a `nightly` compiler -is required until this feature is stabilized**. See the [tracking issue] for its -current status. - -[tracking issue]: https://github.com/rust-lang/rust/issues/75243 - ## License Licensed under either of diff --git a/src/lib.rs b/src/lib.rs index b1bee64..56f79e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,8 +4,6 @@ //! buffers with interfaces similar to the standard library's [`VecDeque`]. //! //! [`VecDeque`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html -//! [`array_map`]: https://doc.rust-lang.org/unstable-book/library-features/array-map.html -//! [tracking issue]: https://github.com/rust-lang/rust/issues/75243 //! //! # Example //! From e8ae6da8a310ce19abfdc38d3d3121b46710f7fe Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Thu, 29 Dec 2022 11:55:26 +0200 Subject: [PATCH 4/4] fix: PR review for impl Copy on ArrayDeque Signed-off-by: Lachezar Lechev --- src/array_deque.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/array_deque.rs b/src/array_deque.rs index ced6f90..4b9cd12 100644 --- a/src/array_deque.rs +++ b/src/array_deque.rs @@ -34,7 +34,7 @@ impl Meta for ArrayMeta { /// All values are stored inline; that is, the size of of `ArrayDeque` is /// *at least* `size_of::<[T; N]>()`, regardless of the number of elements /// currently stored in the deque. -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Debug)] pub struct ArrayDeque where T: Default, @@ -43,6 +43,8 @@ where items: [T; N], } +impl Copy for ArrayDeque {} + impl BaseDeque for ArrayDeque where T: Default,