Skip to content
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

Derive Copy for ArrayDeque #5

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/array_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
BaseDeque, CapacityError, DequeDrain, DequeIter,
};

#[derive(Clone, Debug)]
#[derive(Clone, Copy, Debug)]
pub(crate) struct ArrayMeta<const N: usize> {
layout: MetaLayout,
}
Expand Down Expand Up @@ -43,6 +43,8 @@ where
items: [T; N],
}

impl<T: Copy + Default, const N: usize> Copy for ArrayDeque<T, N> {}

impl<T, const N: usize> BaseDeque<T> for ArrayDeque<T, N>
where
T: Default,
Expand Down
10 changes: 1 addition & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
//! 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
//!
//! # Example
//!
Expand Down Expand Up @@ -84,11 +77,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;
Expand Down