lien
🚧 Under construction 🚧 This crate is somewhat experimental: the recommended API may change (in semver-compatible ways) in future versions.
Scoped lending of borrowed references as Send-able smart pointers. Like thread::scope without the thread!
A lien is "a right to take possession of a debtor's property as security until a debt or duty is discharged." Similarly, a Lien represents a borrow of something from a Scope. Like a static borrow with & or &mut, this forces the Scope to outlive any Liens made from it, but like an Arc, Lien carries no lifetime (it's atomically reference-counted at runtime), is thread-safe, and can be freely cloned.
let mut greeting = Stringfrom;
greeting.push_str;
assert_eq!;
Smart pointers
Lien: a bare scope token.Ref: a sendable shared reference (like&T).RefMut: a sendable exclusive reference (like&mut T).
Both Ref and RefMut support sub-borrowing through Ref::map / RefMut::map, which lets you re-lend fields against the original scope.
#[no_std]
Disable the std feature:
[]
= { = "0.1", = false }