dtolnay / async-trait

Type erasure for async trait methods
Apache License 2.0
1.84k stars 85 forks source link

Account for AFIT stabilization in 1.75.0 #253

Closed stevefan1999-personal closed 10 months ago

stevefan1999-personal commented 11 months ago

As https://github.com/rust-lang/rust/pull/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.

thecaralice commented 10 months ago

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

EstebanBorai commented 10 months ago

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

hiroaki-yamamoto commented 10 months ago

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.

UkonnRa commented 10 months ago

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?

thecaralice commented 10 months ago

@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