I have so far transformed two crates that have iterable-like properties in traits from using HRTBs to GATs. And I was seriously surprised how easy it was. The compiler gave me all the hints I needed to make everything compile. And there were only minor changes required, like removing lifetime arguments from traits or changing the type definition in trait implementations.

I wonder, has anyone encountered any difficulties when transforming their code from HRTBs to GATs?

  • lemmyrs@lemmyrs.orgM
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I’m yet to get my hands dirty with GATs, just haven’t had the opportunity yet. I typically write application code instead of building libraries so that’s partially the reason I suppose. One of these days though I’m sure I’ll get to it.

    It’s promising that you were able to switch with relative ease, excellent work!

  • chrysn@chaos.social
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    @Sibbo It’s been a wild ride ridden with back-and-forths about where where Self: 'a goes and whether it’s needed, but that’s largely past (now that it’s stable), and my use case (the coap-message crate) works fine with it.