diff options
| author | Botahamec <botahamec@outlook.com> | 2024-05-23 20:44:02 -0400 |
|---|---|---|
| committer | Botahamec <botahamec@outlook.com> | 2024-05-23 20:44:02 -0400 |
| commit | fd4ee65a78ecbf376d99377a367137b0b8cdad41 (patch) | |
| tree | 663b211b0da02431b2d100a270d60d48eebbefb0 /examples/list.rs | |
| parent | 0926201a52f860b1f75dda2e9bd6d2e536cc5f68 (diff) | |
| parent | 8ecf29cfe2a74d02b2c4bcb7f7ad1a811dc38dfe (diff) | |
Merge branch '0.2'
Diffstat (limited to 'examples/list.rs')
| -rw-r--r-- | examples/list.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/list.rs b/examples/list.rs index 3b03f2d..a649eeb 100644 --- a/examples/list.rs +++ b/examples/list.rs @@ -1,6 +1,6 @@ use std::thread; -use happylock::{LockCollection, Mutex, ThreadKey}; +use happylock::{collection::RefLockCollection, Mutex, ThreadKey}; const N: usize = 10; @@ -37,7 +37,7 @@ fn main() { data.push(&DATA[rand % 6]); } - let Some(lock) = LockCollection::try_new(data) else { + let Some(lock) = RefLockCollection::try_new(&data) else { continue; }; let mut guard = lock.lock(&mut key); @@ -56,9 +56,9 @@ fn main() { } let key = ThreadKey::get().unwrap(); - let data = LockCollection::new_ref(&DATA); + let data = RefLockCollection::new(&DATA); let data = data.lock(key); for val in &*data { - println!("{}", **val); + println!("{val}"); } } |
