Crates.io | rusturnate |
lib.rs | rusturnate |
version | 0.0.9 |
source | src |
created_at | 2024-04-14 22:15:07.282412 |
updated_at | 2024-05-18 17:15:26.457192 |
description | A sync or async mutex, with or without timeouts. |
homepage | |
repository | https://gitlab.com/in2vd-open/rusturnate |
max_upload_size | |
id | 1208578 |
size | 109,366 |
rusturnate
introduces a cell-like object called a Rusturn
, which may hold an arbitrary type.
It can be shared across thread or future boundaries using Arc
or static
.
Editor
(MutexGuard
)Similar to std::sync::Mutex
, a Rusturn
allows only one thread or future to access its
contents at a time by acquiring an Editor
(similar to a MutexGuard
). There can only be
one editor instance accessing a Rusturn
object at any given moment. To finish editing
the editor must either be dropped or .done()
must be invoked on it. Subsequently, other
threads can acquire a new instance of an editor. If a panic occurs while holding an editor
it gets marked as poisoned. Despite this, access is still possible. However, you will need
to handle the resulting PoisonError
and update the editorĀ“s value to clear its poisoned
state. auto-poisoning
only works if the std
feature is enabled. Otherwise, you can do
manual poisoning by activating the manual_poisoning
or anytime_poisoning
feature.
TODO
Access
objectTODO
TODO
TODO
unsafe
TODO
This crate itself does not perform any heap allocations. However, if the suspending_with_timeout
feature is enabled, it utilizes the futures-timer crate,
which does perform heap allocations. futures-timer
is only used for suspending execution in an
async
context with a timeout.
Rusturn
/Editor
implementationsync/async
awaiting/queuingsync/async
timeoutsREADME.md
explanation