Git Product home page Git Product logo

Comments (4)

taiki-e avatar taiki-e commented on May 27, 2024

At this time I don't have a strong opinion about whether this should be added, but I am a bit concerned that this can complicate the API.

from pin-project.

taiki-e avatar taiki-e commented on May 27, 2024

Given that #[project] isn't really available everywhere, I've come to feel that this makes sense.

Maybe something like this:

#[pin_project(project = FooProj, project_ref = FooProjRef)]
struct Foo<T> {
    #[pin]
    x T: ,
}

impl<T> Foo<'_, T> {}

(It should be mentioned in the documentation that a lifetime is added to the first position in generics.)

from pin-project.

taiki-e avatar taiki-e commented on May 27, 2024

One of the cases that current #[project] cannot support is the following code.

#[pin_project::pin_project(Replace)]
enum E<T, U> {
    A(#[pin] T),
    B(U),
    C,
}

fn foo<T, U>(e: Pin<&mut E<T, Y>>) {
    if let E::A(_a) = e.project() { // needs #[project]
        // ..
    } else if E::B(_b) = e.project_replace(E::C) { // needs #[project_replace]
        //
    }
}

from pin-project.

taiki-e avatar taiki-e commented on May 27, 2024

It should be mentioned in the documentation that a lifetime is added to the first position in generics.

Oh, it seems I forgot to do this in #202.

from pin-project.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.