2 unstable releases
| 0.2.0 | May 7, 2023 |
|---|---|
| 0.1.0 | May 7, 2023 |
#38 in #ownership
6KB
66 lines
process-owned
This Rust crate provides easy access to multiple owners. Using the ProcessOwned struct, multiple owners can share the same data source. Internally, this uses an Rc, but the implementation will be modified for speed.
When paired with the lazy_static crate, this can be used to create a global data source that can be accessed from anywhere in the program.
Example
use process_owned::ProcessOwned;
let mut data = ProcessOwned::new(0);
assert_eq!(*data, 0);
License
This crate is licensed under the MIT license due to its extremely small size. See the LICENSE file for more information.
lib.rs:
This crate provides the ProcessOwned type, a value
that shares its lifetime with the process unless it
can be optimally freed earlier than that.
Internally, ProcessOwned uses the Rc type to
ensure that the value is only dropped when the last
owner is dropped. The specific implementation is
subject to change for performance reasons.