Macro owned_pin::arsc_init_on_stack
source · macro_rules! arsc_init_on_stack { (let $value:ident $(:$ty:ty)? = $($init:tt)*) => { ... }; }
Expand description
Initializes an Arsc pointer on the current calling stack using an
initializer of Init.
Examples
use owned_pin::sync::{RefCount, RefCounted, arsc_init_on_stack};
#[derive(RefCounted)]
struct Large {
x: [u64; 100],
#[count_on]
rc: RefCount,
}
// This value is directly written to the target place,
// instead of being temporarily placed on the stack.
arsc_init_on_stack!(let l = Large {
x <- [0; 100],
rc: RefCount::new(),
});
assert_eq!(l.x, [0; 100]);