Skip to content

Commit 80b2c31

Browse files
committed
Auto merge of #237 - cole-miller:raw-table-default, r=Amanieu
Implement `Default` for `RawTable` This seems straightforward and useful. (I found myself wanting it so I could use `core::mem::take` on a `RawTable` field.) Hopefully I'm not missing something.
2 parents b5b5be8 + f9a46e5 commit 80b2c31

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
## Added
1111
- Added safe `try_insert_no_grow` method to `RawTable`. (#229)
12+
- Implemented `Default` for `RawTable`. (#237)
1213

1314
## Changed
1415
- The minimum Rust version has been bumped to 1.49.0. (#230)

src/raw/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,13 @@ impl<T: Clone, A: Allocator + Clone> RawTable<T, A> {
15871587
}
15881588
}
15891589

1590+
impl<T, A: Allocator + Clone + Default> Default for RawTable<T, A> {
1591+
#[cfg_attr(feature = "inline-more", inline)]
1592+
fn default() -> Self {
1593+
Self::new_in(Default::default())
1594+
}
1595+
}
1596+
15901597
#[cfg(feature = "nightly")]
15911598
unsafe impl<#[may_dangle] T, A: Allocator + Clone> Drop for RawTable<T, A> {
15921599
#[cfg_attr(feature = "inline-more", inline)]

0 commit comments

Comments
 (0)