Macro futures::unsafe_unpinned[][src]

macro_rules! unsafe_unpinned {
    ( $ f : tt : $ t : ty ) => { ... };
}

An unpinned projection of a struct field.

This macro is unsafe because it creates a method that returns a normal non-pin reference to the struct field. It is up to the programmer to ensure that the contained value can be considered not pinned in the current context.

struct Foo {
    field: Bar,
}

impl Foo {
    unsafe_unpinned!(field: Bar);

    fn baz(mut self: PinMut<Self>) {
        let _: &mut Bar = self.field(); // Normal reference to the field
    }
}