toki_no/pin_utils.rs
1/// Pins a value on the stack.
2#[macro_export]
3macro_rules! pin_mut {
4 ($($x:ident),* $(,)?) => { $(
5 // Move the value to ensure that it is owned
6 let mut $x = $x;
7 // Shadow the original binding so that it can't be directly accessed
8 // ever again.
9 #[allow(unused_mut)]
10 let mut $x = unsafe {
11 core::pin::Pin::new_unchecked(&mut $x)
12 };
13 )* }
14}