madsmtm / objc2

Bindings to Apple's frameworks in Rust
https://docs.rs/objc2/
MIT License
280 stars 35 forks source link

`Send + Sync` / `@Sendable` blocks #572

Open madsmtm opened 3 months ago

madsmtm commented 3 months ago

Clang has bindings for Swift's @Sendable protocol on blocks (with the default being non-sendable), we should add support for this into block2.

Basic idea is to allow Block<dyn Fn() + Send + Sync>, though since we don't have custom coercions yet, it likely won't be as pretty as through Deref.

Notes in this comment on whether we should have both Send + Sync, or if we can get away with one of those bounds.