Closed madsmtm closed 3 months ago
Part of https://github.com/madsmtm/objc2/issues/168.
Change the syntax to Block<dyn Fn(Args) -> R>, which more clearly describes the required signature, and allows us to introduce lifetimes to correctly mark noescape/NS_NOESCAPE blocks, and make functions taking those safe.
Block<dyn Fn(Args) -> R>
noescape
NS_NOESCAPE
// Before fn takes_block(block: &Block<(u32,), u8>) { ... } unsafe fn takes_noescape_block(block: &Block<(u32, u32), ()>) { ... } // After fn takes_block(block: &Block<dyn Fn(u32) -> u8>) { ... } fn takes_noescape_block(block: &Block<dyn Fn(u32, u32) + '_>) { ... }
Part of https://github.com/madsmtm/objc2/issues/168.
Change the syntax to
Block<dyn Fn(Args) -> R>
, which more clearly describes the required signature, and allows us to introduce lifetimes to correctly marknoescape
/NS_NOESCAPE
blocks, and make functions taking those safe.