Macro owned_pin::apin_init

source ·
macro_rules! apin_init {
    (let $value:ident $(:$ty:ty)? = $($init:tt)*) => { ... };
}
Expand description

Initializes and pins an Arsc pointer on the current calling stack.

Examples

use owned_pin::sync::{apin_init, RefCounted, RefCount};
use pinned_init::pin_data;

#[pin_data]
#[derive(RefCounted)]
struct A {
    x: u32,
    #[count_on]
    rc: RefCount,
}

apin_init!(let a = A { x: 64, rc: RefCount::new() });
assert_eq!(a.x, 64);