proj

Macro proj 

Source
macro_rules! proj {
    ($input:ident.$field:ident) => { ... };
    (mut $input:ident.$field:ident) => { ... };
}
Expand description

Use proj! to project a wrapper struct, like std::pin::Pin, onto a field of the wrapped type.

ยงExample

struct Foo {
    a: i32,
    b: &'static str,
}
 
let foo = Box::pin(Foo { a: 42, b: "hello, world" });

let a: Pin<_> = proj!(foo.a);
let b = proj!(foo.b);