Loads of cleanup
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
2022-11-27 17:29:29 +01:00
parent aa3ceaed3e
commit efd1acdfa5
45 changed files with 259 additions and 162 deletions

View File

@@ -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' {