diff --git a/Cargo.toml b/Cargo.toml index feb361b..4624817 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "try-lock" version = "0.2.2" # remember to update html_root_url description = "A lightweight atomic lock." keywords = ["lock", "atomic"] -categories = ["concurrency"] +categories = ["concurrency", "no-std"] authors = ["Sean McArthur "] license = "MIT" repository = "https://github.com/seanmonstar/try-lock" diff --git a/src/lib.rs b/src/lib.rs index 7c0feec..64d3ab8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,7 @@ #![deny(missing_docs)] #![deny(missing_debug_implementations)] #![deny(warnings)] +#![cfg_attr(not(test), no_std)] //! A light-weight lock guarded by an atomic boolean. //! @@ -43,10 +44,13 @@ //! assert_eq!(locked2.name, "Spanner Bundle"); //! ``` -use std::cell::UnsafeCell; -use std::fmt; -use std::ops::{Deref, DerefMut}; -use std::sync::atomic::{AtomicBool, Ordering}; +#[cfg(test)] +extern crate core; + +use core::cell::UnsafeCell; +use core::fmt; +use core::ops::{Deref, DerefMut}; +use core::sync::atomic::{AtomicBool, Ordering}; /// A light-weight lock guarded by an atomic boolean. ///