dtolnay / async-trait

Type erasure for async trait methods

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Account for AFIT stabilization in 1.75.0

stevefan1999-personal opened this issue · comments

As rust-lang/rust#115822 was finally merged and will be scheduled to be stabilized alongside 1.75.0 release (although it was expected to merge on 1.74.0), we should think about what to do when 1.75.0 came out.

And here 1.75.0 is. Maybe consider writing a sentence or two on migrating.

Thanks so much to @dtolnay and contributors for this crate! This was so useful to have while waiting for this to happen!

As far as I tried 1.75.0, the official async trait isn't object-safe for now while this crate is. This is the huge advantage of this crate when using Arc<dyn Trait + Send +Sync> style DI. This is why I'd like @dtolnay to keep maintaining this crate until the official async trait gets object-safe.

From official doc, users can use #[trait_variant::make] if they want to swap to AFIT?

From developer side, that's just migrate from one macro to another. I think I will still use #[async_macro] until all of my dependencies support the new feature?

@hiroaki-yamamoto

until the official async trait gets object-safe

This is unlikely to be possible without explicitly bounding Self: Sized in all of the RPITI methods, which prevents them from being accessible through a trait object