9 releases
| 0.0.9 | May 18, 2024 |
|---|---|
| 0.0.8 | May 18, 2024 |
| 0.0.5 | Apr 28, 2024 |
#359 in Concurrency
533 downloads per month
80KB
2K
SLoC
Overview
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.
The 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.
Manual poisoning
TODO
The Access object
TODO
Awaiting results
TODO
Feature flags
TODO
Use of unsafe
TODO
Allocation details
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.
Roadmap
-
Rusturn/Editorimplementation -
sync/asyncawaiting/queuing -
sync/asynctimeouts - auto/manual poisoning
- full
README.mdexplanation - clear documentation for exposed methods
- documentation for internal methods
- explicit edge case tests
- more debug assertions
License
Licensed under either of Apache License, Version 2.0 or MIT license.Dependencies
~185–620KB
~14K SLoC