Skip to content

0.4.17

Compare
Choose a tag to compare
@taiki-e taiki-e released this 18 May 12:26
  • Support naming the projection types.

    By passing an argument with the same name as the method to the attribute, you can name the projection type returned from the method:

    use pin_project::pin_project;
    use std::pin::Pin;
    
    #[pin_project(project = EnumProj)]
    enum Enum<T> {
        Variant(#[pin] T),
    }
    
    fn func<T>(x: Pin<&mut Enum<T>>) {
        match x.project() {
            EnumProj::Variant(y) => {
                let _: Pin<&mut T> = y;
            }
        }
    }