Skip to content

Commit a56de39

Browse files
author
Stjepan Glavina
authored
Merge pull request #3 from librelois/opti/new_const_fn
Opti: make new() a const fn
2 parents f768123 + c4025fa commit a56de39

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

async-barrier/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ categories = ["asynchronous", "concurrency"]
1313
readme = "../README.md"
1414

1515
[dependencies]
16-
async-mutex = "1.1.5"
16+
async-mutex = { path = "../async-mutex", version = "1.4.0" }
1717
event-listener = "2.4.0"
1818

1919
[dev-dependencies]

async-barrier/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl Barrier {
3737
///
3838
/// let barrier = Barrier::new(5);
3939
/// ```
40-
pub fn new(n: usize) -> Barrier {
40+
pub const fn new(n: usize) -> Barrier {
4141
Barrier {
4242
n,
4343
state: Mutex::new(State {

async-mutex/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "async-mutex"
3-
version = "1.3.0"
3+
version = "1.4.0"
44
authors = ["Stjepan Glavina <stjepang@gmail.com>"]
55
edition = "2018"
66
description = "Async mutex"

async-mutex/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<T> Mutex<T> {
6262
///
6363
/// let mutex = Mutex::new(0);
6464
/// ```
65-
pub fn new(data: T) -> Mutex<T> {
65+
pub const fn new(data: T) -> Mutex<T> {
6666
Mutex {
6767
state: AtomicUsize::new(0),
6868
lock_ops: Event::new(),

async-rwlock/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ categories = ["asynchronous", "concurrency"]
1313
readme = "../README.md"
1414

1515
[dependencies]
16-
async-mutex = "1.1.5"
16+
async-mutex = { path = "../async-mutex", version = "1.4.0" }
1717
event-listener = "2.4.0"
1818

1919
[dev-dependencies]

async-rwlock/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl<T> RwLock<T> {
101101
///
102102
/// let lock = RwLock::new(0);
103103
/// ```
104-
pub fn new(t: T) -> RwLock<T> {
104+
pub const fn new(t: T) -> RwLock<T> {
105105
RwLock {
106106
mutex: Mutex::new(()),
107107
no_readers: Event::new(),

async-semaphore/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl Semaphore {
2727
///
2828
/// let s = Semaphore::new(5);
2929
/// ```
30-
pub fn new(n: usize) -> Semaphore {
30+
pub const fn new(n: usize) -> Semaphore {
3131
Semaphore {
3232
count: AtomicUsize::new(n),
3333
event: Event::new(),

0 commit comments

Comments
 (0)