hoist_temporaries

Crates.iohoist_temporaries
lib.rshoist_temporaries
version0.2.1
sourcesrc
created_at2020-08-02 14:40:33.474967
updated_at2020-08-03 00:03:57.560822
descriptionProcedural macro to extend the lifetimes of temporary variables.
homepage
repositoryhttps://github.com/illicitonion/hoist_temporaries
max_upload_size
id272237
size15,186
Daniel Wagner-Hall (illicitonion)

documentation

README

hoist_temporaries

Procedural macro to extend the lifetimes of temporary variables.

crates.io Documentation Build Status

Examples

See working examples for more examples.

#[hoist_temporaries::hoist_temporaries]
fn main() {
    #[hoist_temporaries::hoist]
    let mut snack = "Cheese";
    if true {
        // Without hoist_temporaries, this would error because the format!() returns a temporary which would otherwise be dropped because it has no owner.
        snack = &format!("{}burger", snack);
    }
    assert_eq!(snack, "Cheeseburger");
}
Commit count: 6

cargo fmt