diff options
| author | Mica White <botahamec@outlook.com> | 2026-09-13 15:12:08 -0400 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2026-09-13 15:12:08 -0400 |
| commit | 16d6bd7ece4c4b9b72f6bd51c9b034270b745525 (patch) | |
| tree | 4ff744fc41319ce73abe06416fabeaa7c17fbd46 /src/context.rs | |
| parent | 9fd7b94cd7c20abe66cea875a0e83e76a7a00fbc (diff) | |
Support no_stdno-std
Diffstat (limited to 'src/context.rs')
| -rw-r--r-- | src/context.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/context.rs b/src/context.rs index 1707022..12564f1 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,4 +1,4 @@ -use std::marker::PhantomData; +use core::marker::PhantomData; use crate::ThreadKey; @@ -183,12 +183,14 @@ pub struct ContextGuard<'a, Guard, Key> { #[cfg(test)] mod tests { + #[cfg(feature = "std")] use crate::{ collection::OwnedLockCollection, context::iterator::TryLockNextError, Mutex, RwLock, ThreadKey, }; #[test] + #[cfg(feature = "std")] fn display_works_for_guard() { let key = ThreadKey::get().unwrap(); let collection = OwnedLockCollection::new((Mutex::new("Hello, world!"),)); @@ -199,6 +201,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn try_lock_mut_works_single_element_tuple() { let key = ThreadKey::get().unwrap(); let collection = OwnedLockCollection::new((RwLock::new(42),)); @@ -235,6 +238,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn try_lock_mut_works_double_element_tuple() { let key = ThreadKey::get().unwrap(); let collection = OwnedLockCollection::new((RwLock::new(42), RwLock::new(67))); @@ -300,6 +304,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn try_lock_mut_works_triple_element_tuple() { let key = ThreadKey::get().unwrap(); let collection = OwnedLockCollection::new((RwLock::new(1), RwLock::new(2), RwLock::new(3))); @@ -393,6 +398,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn basic_iteration() { let key = ThreadKey::get().unwrap(); let data = [Mutex::new(1), Mutex::new(3), Mutex::new(8)]; @@ -410,6 +416,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn recurse_tuple_of_lists() { let key = ThreadKey::get().unwrap(); let data = ( @@ -435,6 +442,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn recurse_list_of_lists() { let key = ThreadKey::get().unwrap(); let data = [ @@ -465,6 +473,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn recurse_last_list_of_lists() { let key = ThreadKey::get().unwrap(); let data = [ @@ -486,6 +495,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn recurse_last_list_of_empty_list() { let key = ThreadKey::get().unwrap(); let data: [[Mutex<i32>; 0]; 0] = []; @@ -498,6 +508,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn recurse_list_of_tuples() { let key = ThreadKey::get().unwrap(); let data = [ @@ -534,6 +545,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn recurse_last_list_of_tuples() { let key = ThreadKey::get().unwrap(); let data = [ @@ -556,6 +568,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn recurse_last_of_empty_list_of_tuples() { let key = ThreadKey::get().unwrap(); let data: [(Mutex<bool>, Mutex<i32>); 0] = []; @@ -568,6 +581,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn lock_last_of_list() { let key = ThreadKey::get().unwrap(); let data = [Mutex::new(1), Mutex::new(3), Mutex::new(8)]; @@ -579,6 +593,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn try_lock_next_works() { let key = ThreadKey::get().unwrap(); let data = [Mutex::new(1), Mutex::new(3), Mutex::new(8)]; |
