diff --git a/core/Cargo.toml b/core/Cargo.toml index 06d0c8d..dda020f 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hyperparameter" -version = "0.5.10" +version = "0.5.11" license = "Apache-2.0" description = "A high performance configuration system for Rust." homepage = "https://reiase.github.io/hyperparameter/" diff --git a/core/src/api.rs b/core/src/api.rs index c8b1553..09862b8 100644 --- a/core/src/api.rs +++ b/core/src/api.rs @@ -1,6 +1,9 @@ use std::collections::HashSet; use std::fmt::Debug; +use const_str; +use xxhash_rust; + use crate::storage::{ frozen_global_storage, Entry, GetOrElse, MultipleVersion, Params, THREAD_STORAGE, }; @@ -184,15 +187,15 @@ pub fn frozen() { #[macro_export] macro_rules! get_param { ($name:expr, $default:expr) => {{ - const CONST_KEY: &str = ::const_str::replace!(stringify!($name), ";", ""); - const CONST_HASH: u64 = ::xxhash_rust::const_xxh64::xxh64(CONST_KEY.as_bytes(), 42); + const CONST_KEY: &str = const_str::replace!(stringify!($name), ";", ""); + const CONST_HASH: u64 = xxhash_rust::const_xxh64::xxh64(CONST_KEY.as_bytes(), 42); THREAD_STORAGE.with(|ts| ts.borrow_mut().get_or_else(CONST_HASH, $default)) // ParamScope::default().get_or_else(CONST_HASH, $default) }}; ($name:expr, $default:expr, $help: expr) => {{ - const CONST_KEY: &str = ::const_str::replace!(stringify!($name), ";", ""); - const CONST_HASH: u64 = ::xxhash_rust::const_xxh64::xxh64(CONST_KEY.as_bytes(), 42); + const CONST_KEY: &str = const_str::replace!(stringify!($name), ";", ""); + const CONST_HASH: u64 = xxhash_rust::const_xxh64::xxh64(CONST_KEY.as_bytes(), 42); // ParamScope::default().get_or_else(CONST_HASH, $default) { const CONST_HELP: &str = $help; @@ -238,7 +241,7 @@ macro_rules! with_params { ) =>{ let mut ps = ParamScope::default(); { - const CONST_KEY: &str = ::const_str::replace!(stringify!($($key).+), ";", ""); + const CONST_KEY: &str = const_str::replace!(stringify!($($key).+), ";", ""); ps.put(CONST_KEY, $val); } with_params!(params ps; $($body)*) @@ -251,7 +254,7 @@ macro_rules! with_params { $($body:tt)* ) => { { - const CONST_KEY: &str = ::const_str::replace!(stringify!($($key).+), ";", ""); + const CONST_KEY: &str = const_str::replace!(stringify!($($key).+), ";", ""); $ps.put(CONST_KEY, $val); } with_params!(params $ps; $($body)*) @@ -339,7 +342,7 @@ macro_rules! with_params_readonly { ) =>{ let mut ps = ParamScope::default(); { - const CONST_KEY: &str = ::const_str::replace!(stringify!($($key).+), ";", ""); + const CONST_KEY: &str = const_str::replace!(stringify!($($key).+), ";", ""); ps.put(CONST_KEY, $val); } with_params!(params ps; $($body)*) diff --git a/core/src/lib.rs b/core/src/lib.rs index 4f125bb..1e834c0 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -19,6 +19,8 @@ pub use crate::storage::THREAD_STORAGE; pub use crate::value::Value; pub use crate::xxh::xxhash; pub use crate::xxh::XXHashable; +pub use const_str; +pub use xxhash_rust; #[cfg(feature = "clap")] mod cli;