PackageTrack
Sign in Get early access

block2

Apple's C language extension of blocks

0.6.2 88M downloads/mo #877 most downloaded on crates.io madsmtm/objc2

What this package is like to depend on

Last release 10 months ago

04 Oct 2025

Ships fairly regularly

a new release about every 4 months

Nearly every release is documented

notes for 9 of 9 stable releases

Nothing withdrawn

no release was ever pulled

5 years old

18 releases · first in 2021

1 release in the last 12 months

see the full history below

Release timeline

18 releases · Nov 2021 to Oct 2025
2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 18
  1. 0.6.2 04 Oct 2025
    Release notes

    Fix documentation on docs.rs

    Open source →
    Release notes

    Fixed

    • Fixed documentation on docs.rs.
    Open source →
  2. 0.6.1 19 Apr 2025
    Release notes

    chore: Release block2 version 0.6.1

    Open source →
    Release notes

    Added

    • Added DynBlock alias to help facilitate upgrading to v0.7 when that's done.

    Fixed

    • Slightly improved documentation around ManualBlockEncoding.
    Open source →
  3. 0.6.0 22 Jan 2025
    Release notes

    Added

    • Added StackBlock::with_encoding and RcBlock::with_encoding for creating blocks with an encoding specified by ManualBlockEncoding.

      This is useful for certain APIs that require blocks to have an encoding.

    • Added RcBlock::as_ptr.

    • Added RcBlock::into_raw.

    Changed

    • BREAKING: Updated objc2 dependency to v0.6.0.

    Fixed

    • BREAKING: Converted function signatures into using extern "C-unwind". This allows unwinding through blocks.

    Removed

    • BREAKING: Removed the deprecated apple Cargo feature flag.
    Open source →
  4. 0.5.1 21 May 2024
    Release notes

    Deprecated

    • Deprecated the apple Cargo feature flag, it is assumed by default on Apple platforms.
    Open source →
  5. 0.5.0 17 Apr 2024
    Release notes

    Added

    • BREAKING: Added Block::copy to convert blocks to RcBlock. This replaces StackBlock::copy, but since StackBlock implements Deref, this will likely work as before.
    • Added RcBlock::new(closure) as a more efficient and flexible alternative to StackBlock::new(closure).copy().
    • Added BlockFn trait to describe valid dyn Fn types for blocks.

    Changed

    • BREAKING: Changed how blocks specify their parameter and return types. We now use dyn Fn so that it is more clear what the parameter and return types are. This also allows us to support non-'static blocks.

      // Before
      let block: &Block<(), ()>;
      let block: &Block<(i32,), i32>;
      let block: &Block<(i32, u32), (i32, u32)>;
      
      // After
      let block: &Block<dyn Fn()>;
      let block: &Block<dyn Fn(i32) -> i32>;
      let block: &Block<dyn Fn(i32, u32) -> (i32, u32)>;
      // Now possible
      let block: &Block<dyn Fn() + '_>; // Non-'static block
      
    • BREAKING: Make Block::call safe, and instead move the upholding of the safety invariant to the type itself.

    • BREAKING: Renamed RcBlock::new(ptr) to RcBlock::from_raw(ptr).

    • BREAKING: Made RcBlock use the null-pointer optimization; RcBlock::from_raw and RcBlock::copy now return an Option.

    • BREAKING: Only expose the actually public symbols _Block_copy, _Block_release, _Block_object_assign, _Block_object_dispose, _NSConcreteGlobalBlock, _NSConcreteStackBlock and Class in ffi module.

    • BREAKING: Renamed IntoConcreteBlock to IntoBlock, moved associated type Output to be a generic parameter, and added lifetime parameter.`

    • No longer use the block-sys crate for linking to the blocks runtime.

    • Renamed ConcreteBlock to StackBlock, and added a lifetime parameter. The old name is deprecated.

    • Added Copy implementation for StackBlock.

    Removed

    • BREAKING: Removed BlockArguments in favour of BlockFn, which describes both the parameter types, as well as the return type.

    Fixed

    • BREAKING: StackBlock::new now requires the closure to be Clone. If this is not desired, use RcBlock::new instead.
    • Relaxed the F: Debug bound on StackBlock's Debug implementation.
    • BREAKING: Fixed GlobalBlock not having the correct variance. This may break if you were using lifetimes in your parameters, as those are now a bit too restrictive.
    Open source →
  6. 0.4.0 03 Dec 2023
    Release notes

    Changed

    • BREAKING: Updated objc2 dependency to v0.5.0.
    Open source →
  7. 0.3.0 31 Jul 2023
    Release notes

    Fixed

    • Bumped version number to ensure that this crate can be compiled together with code that depends on pre-releases of 0.2.0.
    Open source →
  8. 0.2.0 20 Jun 2023
    Release notes

    Changed

    • BREAKING: Updated objc2 dependency to v0.4.0.
    Open source →
  9. 0.2.0-alpha.8 07 Feb 2023 pre-release
    Release notes

    Changed

    • BREAKING: Use traits from objc2 v0.3.0-beta.5 instead of objc2-encode.
    • Updated ffi module to block-sys v0.2.0.
    Open source →
  10. 0.2.0-alpha.7 24 Dec 2022 pre-release
    Release notes

    Changed

    • Improve efficiency when a block doesn't need to be destroyed.
    • BREAKING: Updated objc2-encode to v2.0.0-pre.3.
    • Updated ffi module to block-sys v0.1.0-beta.2.
    Open source →
  11. 0.2.0-alpha.6 28 Aug 2022 pre-release
    Release notes

    Changed

    • BREAKING: Updated objc2-encode to v2.0.0-pre.2.
    • Updated ffi module to block-sys v0.1.0-beta.1.

    Fixed

    • BREAKING: Cleaned up BlockArguments trait, it is now sealed and a subtrait of EncodeArguments.
    • BREAKING: Cleaned up IntoConcreteBlock trait, it is now sealed and the associated output type has been renamed to Output.
    Open source →
  12. 0.2.0-alpha.5 19 Jul 2022 pre-release
    Release notes

    Added

    • Implemented Debug for Block, ConcreteBlock, RcBlock and GlobalBlock.

    Changed

    • BREAKING: Updated objc2-encode to v2.0.0-pre.1.
    • Updated ffi module to block-sys v0.1.0-beta.0.
    Open source →
  13. 0.2.0-alpha.4 13 Jun 2022 pre-release
    Release notes

    Changed

    • BREAKING: Updated objc2-encode to v2.0.0-pre.0.
    • BREAKING: Updated ffi module to block-sys v0.0.4. This tweaks the types of a lot of fields and parameters, and makes the apple runtime always be the default.

    Removed

    • BREAKING: Removed DerefMut implementation for ConcreteBlock.
    Open source →
  14. 0.2.0-alpha.3 03 Jan 2022 pre-release
    Release notes

    Changed

    • Changed global_block! macro to take an optional semicolon at the end.
    • Improved documentation.
    • BREAKING: Updated ffi module to block-sys v0.0.3.
    Open source →
  15. 0.2.0-alpha.2 22 Dec 2021 pre-release
    Release notes

    Added

    • GlobalBlock and corresponding global_block! macro, allowing statically creating blocks that don't reference their environment.

    Changed

    • BREAKING: Updated ffi module to block-sys v0.0.2. This means that Class is now !UnwindSafe.
    Open source →
  16. 0.2.0-alpha.1 22 Nov 2021 pre-release
    Release notes

    Added

    • Proper GNUStep support using block-sys. See that crate for usage.
    • Export block-sys as ffi module.

    Removed

    • Dependency on objc_test_utils.

    Fixed

    • ConcreteBlock no longer allocates block descriptors on the heap.
    • Better unwind safety in ConcreteBlock::copy.
    Open source →
  17. 0.2.0-alpha.0 22 Nov 2021 pre-release
    Release notes

    Added

    • BREAKING: Blocks now require that parameter and return types implement objc2_encode::Encode. This is a safety measure to prevent creating blocks with invalid parameters.
    • Blocks now implements objc2_encode::RefEncode (and as such can be used in Objective-C message sends).
    • Update to 2018 edition.

    Changed

    • BREAKING: Forked the project, so it is now available under the name block2.

    Fixed

    • Soundness issues with using empty enums over FFI.
    Open source →
  18. 0.1.6 19 Nov 2021
    Release notes

    Added

    • Support for linking to libBlocksRuntime.
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive