| Crates.io | ref-extended |
| lib.rs | ref-extended |
| version | 0.2.1 |
| created_at | 2022-12-07 05:31:17.310549+00 |
| updated_at | 2022-12-08 13:27:13.835326+00 |
| description | Achieve lifetime of value by shortening entire program lifetime |
| homepage | |
| repository | https://github.com/storycraft/ref-extended |
| max_upload_size | |
| id | 731622 |
| size | 5,620 |
Extends lifetime of reference to same as lifetime of value by shortening entire program lifetime
let mut a = 2_i32; // The lifetime of value itself(not reference) is 'static
// Safely extend lifetimes and abort after expression finish
ref_extended!(|&a| {
identity::<&'static i32>(a); // This compiles
});
// Unreachable. Process abort