Note
This crate has been republished because of popular demand to publish the fixed fork as a crate. However, I can't make any guarantees about the safety of this crate, and I won't necessarilly be able to actively maintain it.
safer_owning_ref
A library for creating references that carry their owner with them.
This can sometimes be useful because Rust borrowing rules normally prevent moving a type that has been borrowed from. For example, this kind of code gets rejected:
This library enables this safe usage by keeping the owner and the reference bundled together in a wrapper type that ensure that lifetime constraint:
Getting Started
To get started, add the following to Cargo.toml
.
= "0.5.0"
(Note: The package's name is safer_owning_ref
, but the crate name is still owning_ref
).
...and see the docs for how to use it.
Example
extern crate owning_ref;
use BoxRef;