mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Add Hash impl to RocStr
This commit is contained in:
parent
1001fdff82
commit
713f8bc4ed
1 changed files with 7 additions and 0 deletions
|
@ -6,6 +6,7 @@ use core::{
|
|||
mem::{size_of, ManuallyDrop},
|
||||
ops::{Deref, DerefMut},
|
||||
};
|
||||
use std::hash::Hash;
|
||||
|
||||
use crate::{rc::ReferenceCount, RocList};
|
||||
|
||||
|
@ -231,3 +232,9 @@ impl DerefMut for SmallString {
|
|||
unsafe { core::str::from_utf8_unchecked_mut(self.bytes.get_unchecked_mut(..len)) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Hash for RocStr {
|
||||
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
||||
self.as_str().hash(state)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue