Macro owned_pin::init_on_stack
source · macro_rules! init_on_stack { (let $value:tt $(: $ty:ty)? = $($init:tt)*) => { ... }; }
Expand description
Initializes an owned value directly on the stack using an initializer of
Init.
Examples
use owned_pin::init_on_stack;
use pinned_init::pin_data;
#[pin_data]
struct X {
a: [u64; 100],
}
// This value is directly written to the target place,
// instead of being temporarily placed on the stack.
init_on_stack!(let x = X {
a <- [0; 100]
});
assert_eq!(x.a, [0; 100]);