Make EntityHashMap::new
and EntityHashSet::new
const (#17615)
# Objective #16912 turned `EntityHashMap` and `EntityHashSet` into proper newtypes instead of type aliases. However, this removed the ability to create these collections in const contexts; previously, you could use `EntityHashSet::with_hasher(EntityHash)`, but it doesn't exist anymore. ## Solution Make `EntityHashMap::new` and `EntityHashSet::new` const methods.
This commit is contained in:
parent
7d68ac029e
commit
59697f9ccc
@ -26,7 +26,7 @@ impl<V> EntityHashMap<V> {
|
||||
/// Equivalent to [`HashMap::with_hasher(EntityHash)`].
|
||||
///
|
||||
/// [`HashMap::with_hasher(EntityHash)`]: HashMap::with_hasher
|
||||
pub fn new() -> Self {
|
||||
pub const fn new() -> Self {
|
||||
Self(HashMap::with_hasher(EntityHash))
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ impl EntityHashSet {
|
||||
/// Equivalent to [`HashSet::with_hasher(EntityHash)`].
|
||||
///
|
||||
/// [`HashSet::with_hasher(EntityHash)`]: HashSet::with_hasher
|
||||
pub fn new() -> Self {
|
||||
pub const fn new() -> Self {
|
||||
Self(HashSet::with_hasher(EntityHash))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user