13
submitted 1 year ago by Sibbo@sopuli.xyz to c/rustlang@lemmyrs.org

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?

top 2 comments
sorted by: hot top controversial new old
[-] admin@lemmyrs.org 3 points 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 1 points 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.

this post was submitted on 10 Jun 2023
13 points (100.0% liked)

Rust Lang

55 readers
1 users here now

Rules [Developing]

Observe our code of conduct

Constructive criticism only

No endless relitigation

No low-effort content

No memes or image macros

No NSFW Content

founded 1 year ago
MODERATORS