Skip to content

Commit e4791ea

Browse files
authored
Add From for Hashed (#21690)
# Objective - Calling `Hashed::new` could be annoying if a function accepts it. ## Solution - Add `From` impl to allow creating functions that accepts `impl From<V>`.
1 parent 18cd93f commit e4791ea

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/bevy_platform/src/hash.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ impl<V, H> Hash for Hashed<V, H> {
6666
}
6767
}
6868

69+
impl<V: Hash, H: BuildHasher + Default> From<V> for Hashed<V, H> {
70+
fn from(value: V) -> Self {
71+
Self::new(value)
72+
}
73+
}
74+
6975
impl<V, H> Deref for Hashed<V, H> {
7076
type Target = V;
7177

0 commit comments

Comments
 (0)