Registry / utility / rental

rental

JSON →
library0.5.6rscratesunverified

A macro to generate safe self-referential structs with premade types for common use cases.

# Cargo.toml [dependencies] rental = "0.5.6"
INSTALL
IMPORT
SIG · RENTAL
R
rental
utilityrustv0.5.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

rental
use rental::rental;

Create a self-referential struct with a borrowed slice.

use rental::rental; rental! { pub mod my_rental { pub struct MyRental { data: Box<i32>, slice: &'data [i32], } } } fn main() { let rental = my_rental::MyRental::new(Box::new(42), |data| &data[..]); println!("{}", rental.rent(|slice| slice[0])); }
Debug
Known issues
breakingRental is known to have soundness issues with newer Rust versions; consider alternatives like `ouroboros`.
fix
Use `ouroboros` or `self_cell` instead for safe self-referential structs.
affects: >=0.5.0
Upgrade
Version history
0.5.6latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
rental — cargo add rental · libregistry