Skip to content

Commit 81de565

Browse files
committed
feat: const-default_1 Cargo feature
1 parent d57a6a2 commit 81de565

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
10+
### Added
11+
12+
- `const-default_1` Cargo feature, which enables the implementation of [`ConstDefault`](https://docs.rs/const-default/1.0.0/const_default/trait.ConstDefault.html) from [`const-default ^1`](https://crates.io/crates/const-default/1.0.0).
13+
914
## [0.3.5] - 2021-09-04
1015

1116
### Added

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ maintenance = { status = "passively-maintained" }
2525
[dependencies]
2626
spin = { version = "0.9.2", optional = true }
2727

28+
[dependencies.const-default_1]
29+
package = "const-default"
30+
version = "1"
31+
optional = true
32+
default-features = false
33+
2834
[dev-dependencies]
2935
rayon = "1.5.1"
3036
futures = "0.3.17"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ let _ = token_1;
256256
- **`alloc`** enables the items that depend on `alloc`.
257257
- **`unstable`** enables experimental items that are not subject to the
258258
semver guarantees.
259+
- **`const-default_1`** enables the implementation of `ConstDefault` from
260+
[`const-default ^1`][].
261+
262+
[`const-default ^1`]: https://crates.io/crates/const-default/1.0.0
259263

260264
## Related Work
261265

src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@
286286
//! - **`alloc`** enables the items that depend on `alloc`.
287287
//! - **`unstable`** enables experimental items that are not subject to the
288288
//! semver guarantees.
289+
//! - **`const-default_1`** enables the implementation of `ConstDefault` from
290+
//! [`const-default ^1`][].
291+
//!
292+
//! [`const-default ^1`]: https://crates.io/crates/const-default/1.0.0
289293
//!
290294
//! # Related Work
291295
//!
@@ -550,6 +554,17 @@ macro_rules! impl_common {
550554
}
551555
}
552556

557+
#[cfg(feature = "const-default_1")]
558+
impl<
559+
T: const_default_1::ConstDefault,
560+
Keyhole: const_default_1::ConstDefault
561+
> const_default_1::ConstDefault for $ty<T, Keyhole> {
562+
const DEFAULT: Self = Self {
563+
keyhole: const_default_1::ConstDefault::DEFAULT,
564+
data: const_default_1::ConstDefault::DEFAULT,
565+
};
566+
}
567+
553568
/// # Construction and Destruction
554569
///
555570
impl<T, Keyhole> $ty<T, Keyhole> {

0 commit comments

Comments
 (0)