Skip to content

Commit 3d9a1fd

Browse files
committed
make const fn
1 parent 8dd5eec commit 3d9a1fd

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "arraydeque"
3-
version = "0.5.0"
3+
version = "0.5.1"
44
authors = ["andylokandy"]
55
license = "MIT/Apache-2.0"
66
edition = "2021"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ fn main() {
5858

5959
## Changelog
6060

61+
- 0.5.1 Make `ArrayDeque::new()` a const fn.
62+
-
6163
- 0.5.0 Support consnt generic capacity. Remove `use_generic_array` feature.
6264

6365
- 0.4.5 Update `generic-array` to `0.12`.

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ impl<T, const CAP: usize, B: Behavior> ArrayDeque<T, CAP, B> {
10021002
/// let buf: ArrayDeque<usize, 2> = ArrayDeque::new();
10031003
/// ```
10041004
#[inline]
1005-
pub fn new() -> ArrayDeque<T, CAP, B> {
1005+
pub const fn new() -> ArrayDeque<T, CAP, B> {
10061006
ArrayDeque {
10071007
xs: MaybeUninit::uninit(),
10081008
tail: 0,
@@ -1023,7 +1023,7 @@ impl<T, const CAP: usize, B: Behavior> ArrayDeque<T, CAP, B> {
10231023
/// assert_eq!(buf.capacity(), 2);
10241024
/// ```
10251025
#[inline]
1026-
pub fn capacity(&self) -> usize {
1026+
pub const fn capacity(&self) -> usize {
10271027
CAP
10281028
}
10291029

0 commit comments

Comments
 (0)