Cargo Features

bytemuck has no features set by default.

[dependencies]
bytemuck = { version = "1.19.0", features = ["derive", "extern_crate_alloc", "extern_crate_std", "zeroable_maybe_uninit", "zeroable_atomics", "align_offset", "min_const_generics", "wasm_simd", "aarch64_simd", "must_cast", "const_zeroed", "unsound_ptr_pod_impl", "track_caller", "latest_stable_rust", "nightly_portable_simd", "nightly_stdsimd", "nightly_float", "nightly_docs"] }
derive latest_stable_rust? = bytemuck_derive

In v2 we'll fix these names to be more "normal".

Enable deriving the various bytemuck traits.

extern_crate_alloc extern_crate_std?

Enable features requiring items from extern crate alloc.

Affects bytemuck::allocation

extern_crate_std = extern_crate_alloc

Enable features requiring items from extern crate std.

zeroable_maybe_uninit latest_stable_rust?

Implement Zeroable for MaybeUninit.

zeroable_atomics latest_stable_rust?

Implement Zeroable for std::sync::atomic types.

align_offset latest_stable_rust?

All MSRV notes below are GUIDELINES and future versions may require even more MSRV on any feature.

MSRV 1.36: Use align_offset method instead of casting to usize to check alignment of pointers, this may improve codegen in some cases (but it has never been formally benchmarked!)

min_const_generics latest_stable_rust?

MSRV 1.51: support arrays via min_const_generics

wasm_simd latest_stable_rust?

MSRV 1.54.0: support wasm simd types

aarch64_simd latest_stable_rust?

MSRV 1.59.0: support aarch64 simd types

must_cast latest_stable_rust?

MSRV 1.64.0: support the must module.

const_zeroed latest_stable_rust?

MSRV 1.75.0: support const zeroed()

Affects bytemuck::zeroed

unsound_ptr_pod_impl

Do not use if you can avoid it, because this is **unsound**!!!!

track_caller latest_stable_rust?

MSRV 1.46.0: adds the #[track_caller] attribute to functions which may panic

latest_stable_rust = aarch64_simd, align_offset, const_zeroed, derive, min_const_generics, must_cast, track_caller, wasm_simd, zeroable_atomics, zeroable_maybe_uninit

Enables all features that are both sound and supported on the latest stable version of Rust, with the exception of extern_crate_alloc and extern_crate_std. Note: Enabling this feature opts out of any MSRV guarantees!

nightly_portable_simd

ALL FEATURES BELOW THIS ARE NOT SEMVER SUPPORTED! TEMPORARY ONLY!

Enable support for std::simd types.

nightly_stdsimd

Enable support for unstable std::arch types (such as the AVX512 types).

nightly_float

Enable f16 and f128

nightly_docs

Improved documentation using the nightly toolchain

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

bytemuck_derive derive?