| Crates.io | safe-lock |
| lib.rs | safe-lock |
| version | 0.1.4 |
| created_at | 2021-03-18 22:26:52.744478+00 |
| updated_at | 2024-10-28 00:17:03.332304+00 |
| description | A lock struct with a `const fn` constructor and no `unsafe` - ARCHIVED |
| homepage | |
| repository | https://gitlab.com/leonhard-llc/ops |
| max_upload_size | |
| id | 370781 |
| size | 12,330 |
This crate is archived and will not be updated.
[std::sync::Mutex] got a const constructor, making this crate unnecessary.
See rustlang/rust#66806.
Don't use this crate. Just use [std::sync::Mutex].
For folks who continue using this crate,
SafeLock is now a simple wrapper around [std::sync::Mutex],
so their tests will run a bit faster.
A simple SafeLock struct.
stdforbid(unsafe_code)Mutex<T>. Does not contain a value.AtomicBool
in a spinlock, not fast OS locks.rusty-fork
std::sync::Mutex
core::lazy::OnceCell
or various unsafe crates:
lazy_static,
once_cell,
lazycell, and
conquer-once.parking_lot
unsafetry-lock
no_stdunsaferuspiro-lock
no_stdunsafeflexible-locks
unsafesafina-sync
provides a safe async MutexMake some tests run sequentially so they don't interfere with each other:
use safe_lock::SafeLock;
static LOCK: SafeLock = SafeLock::new();
[#test]
fn test1() {
let _guard = LOCK.lock();
// ...
}
[#test]
fn test2() {
let _guard = LOCK.lock();
// ...
}
Metric output format: x/y
x = unsafe code used by the build
y = total unsafe code found in the crate
Symbols:
🔒 = No `unsafe` usage found, declares #![forbid(unsafe_code)]
❓ = No `unsafe` usage found, missing #![forbid(unsafe_code)]
☢️ = `unsafe` usage found
Functions Expressions Impls Traits Methods Dependency
0/0 0/0 0/0 0/0 0/0 🔒 safe-lock 0.1.4
0/0 0/0 0/0 0/0 0/0
SafeLock a wrapper around [std::sync::Mutex] since it got a const constructor.Acquire and Release orderingLicense: Apache-2.0