Cargo Features

bytemuck has no features set by default.

[dependencies]
bytemuck = { version = "1.21.0", features = ["derive", "extern_crate_alloc", "extern_crate_std", "zeroable_maybe_uninit", "zeroable_atomics", "align_offset", "min_const_generics", "wasm_simd", "aarch64_simd", "avx512_simd", "must_cast", "must_cast_extra", "transparentwrapper_extra", "const_zeroed", "alloc_uninit", "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

avx512_simd latest_stable_rust?

MSRV 1.72.0: support avx512 simd types

must_cast latest_stable_rust? must_cast_extra?

MSRV 1.64.0: support the must module.

must_cast_extra latest_stable_rust? = must_cast

MSRV 1.83.0: support mutable references in const

Affects must::must_cast_mut, must::must_cast_slice_mut

transparentwrapper_extra latest_stable_rust?

Adds TransparentWrapper impls for stdlib types newer than bytemuck's base MSRV. Current MSRV 1.74.0: core::num::Saturating. MSRV may increase if impls are added for newer types.

const_zeroed latest_stable_rust?

MSRV 1.75.0: support const zeroed()

Affects bytemuck::zeroed

alloc_uninit latest_stable_rust?

MSRV 1.82.0: support zeroed_*rc* when combined with extern_crate_alloc

Affects allocation::zeroed_arc, allocation::zeroed_arc_slice, allocation::zeroed_rc, allocation::zeroed_rc_slice

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, alloc_uninit, avx512_simd, const_zeroed, derive, min_const_generics, must_cast, must_cast_extra, track_caller, transparentwrapper_extra, 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?