This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::{ValueIdentifiable, ValueIdentifier};
|
||||
use arcstr::ArcStr;
|
||||
use hashbrown::HashMap;
|
||||
use parking_lot::RwLock;
|
||||
@@ -13,7 +14,7 @@ use std::sync::LazyLock;
|
||||
/// free speed out of it. Note that StringKeys also compare case insensitive, so that for example
|
||||
/// `charmander` == `Charmander`.
|
||||
#[derive(Clone, Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
|
||||
pub struct StringKey {
|
||||
/// The underlying reference counted string.
|
||||
str: ArcStr,
|
||||
@@ -122,6 +123,12 @@ impl From<&CStr> for StringKey {
|
||||
}
|
||||
}
|
||||
|
||||
impl ValueIdentifiable for StringKey {
|
||||
fn value_identifier(&self) -> ValueIdentifier {
|
||||
ValueIdentifier::new(self.hash as usize)
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts a character to lowercased in a const safe way.
|
||||
const fn to_lower(c: u8) -> u8 {
|
||||
if c >= b'A' && c <= b'Z' {
|
||||
|
||||
Reference in New Issue
Block a user