Macro owned_pin::opin

source ·
macro_rules! opin {
    ($value:expr) => { ... };
}
Expand description

Pins a value onto the current calling stack.

If the value is Unpin, the user can safety move out the value and use it again.

Examples

use owned_pin::{opin, unpin};

// Pins the value onto the stack.
let pinned = opin!(String::from("Hello!"));
// Retrieves back the data because `String` is `Unpin`.
let string: String = unpin(pinned);
assert_eq!(string, "Hello!");