diff --git a/Cargo.toml b/Cargo.toml index 477c1ae..eba4bd4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lazy_static" # NB: When modifying, also modify html_root_url in lib.rs -version = "0.2.11" +version = "1.0.0" authors = ["Marvin Löbel "] license = "MIT/Apache-2.0" @@ -30,7 +30,7 @@ compiletest = ["compiletest_rs"] appveyor = { repository = "rust-lang-nursery/lazy-static.rs" } travis-ci = { repository = "rust-lang-nursery/lazy-static.rs" } -# is-it-maintained-issue-resolution = { repository = "rust-lang-nursery/lazy-static.rs" } -# is-it-maintained-open-issues = { repository = "rust-lang-nursery/lazy-static.rs" } +is-it-maintained-issue-resolution = { repository = "rust-lang-nursery/lazy-static.rs" } +is-it-maintained-open-issues = { repository = "rust-lang-nursery/lazy-static.rs" } maintenance = { status = "passively-maintained" } diff --git a/README.md b/README.md index ad5380e..2cd30d0 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Add the following dependency to your Cargo manifest... ```toml [dependencies] -lazy_static = "0.2" +lazy_static = "1.0" ``` ...and see the [docs](https://docs.rs/lazy_static) for how to use it. diff --git a/src/core_lazy.rs b/src/core_lazy.rs index 90c7aaa..ba496a6 100644 --- a/src/core_lazy.rs +++ b/src/core_lazy.rs @@ -26,6 +26,7 @@ impl Lazy { } #[macro_export] +#[doc(hidden)] macro_rules! __lazy_static_create { ($NAME:ident, $T:ty) => { static $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy::new(); diff --git a/src/lazy.rs b/src/lazy.rs index aab1e05..6fd4907 100644 --- a/src/lazy.rs +++ b/src/lazy.rs @@ -32,6 +32,7 @@ impl Lazy { unsafe impl Sync for Lazy {} #[macro_export] +#[doc(hidden)] macro_rules! __lazy_static_create { ($NAME:ident, $T:ty) => { static mut $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy(0 as *const $T, $crate::lazy::ONCE_INIT); diff --git a/src/lib.rs b/src/lib.rs index bb15478..2e36821 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -86,14 +86,24 @@ fn main() { # Implementation details -The `Deref` implementation uses a hidden static variable that is guarded by a atomic check on each access. On stable Rust, the macro may need to allocate each static on the heap. +The `Deref` implementation uses a hidden static variable that is guarded by a atomic check on each access. + +# Cargo features + +This crate provides two cargo features: + +- `nightly`: This uses unstable language features only available on the nightly release channel for a more optimal implementation. In practice this currently means avoiding a heap allocation per static. This feature might get deprecated at a later point once all relevant optimizations are usable from stable. +- `spin_no_std` (implies `nightly`): This allows using this crate in a no-std environment, by depending on the standalone `spin` crate. + +Both features depend on unstable language features, which means +no guarantees can be made about them in regard to SemVer stability. */ #![cfg_attr(feature="spin_no_std", feature(const_fn))] #![cfg_attr(feature="nightly", feature(unreachable))] -#![doc(html_root_url = "https://docs.rs/lazy_static/0.2.11")] +#![doc(html_root_url = "https://docs.rs/lazy_static/1.0.0")] #![no_std] #[cfg(not(feature="nightly"))] diff --git a/src/nightly_lazy.rs b/src/nightly_lazy.rs index 0ad0f66..723222a 100644 --- a/src/nightly_lazy.rs +++ b/src/nightly_lazy.rs @@ -36,6 +36,7 @@ impl Lazy { unsafe impl Sync for Lazy {} #[macro_export] +#[doc(hidden)] macro_rules! __lazy_static_create { ($NAME:ident, $T:ty) => { static mut $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy(None, $crate::lazy::ONCE_INIT);