1[package]
2name = "bytemuck"
3description = "A crate for mucking around with piles of bytes."
4version = "1.22.0"
5authors = ["Lokathor <zefria@gmail.com>"]
6repository = "https://github.com/Lokathor/bytemuck"
7readme = "README.md"
8keywords = ["transmute", "bytes", "casting"]
9categories = ["encoding", "no-std"]
10edition = "2018"
11license = "Zlib OR Apache-2.0 OR MIT"
12exclude = ["/pedantic.bat"]
13
14[features]
15# In v2 we'll fix these names to be more "normal".
16
17# Enable deriving the various `bytemuck` traits.
18derive = ["bytemuck_derive"]
19# Enable features requiring items from `extern crate alloc`.
20extern_crate_alloc = []
21# Enable features requiring items from `extern crate std`.
22extern_crate_std = ["extern_crate_alloc"]
23# Implement `Zeroable` for `MaybeUninit`.
24zeroable_maybe_uninit = []
25# Implement `Zeroable` for `std::sync::atomic` types.
26zeroable_atomics = []
27
28# All MSRV notes below are GUIDELINES and future versions may require even more
29# MSRV on any feature.
30
31# MSRV 1.36: Use `align_offset` method instead of casting to `usize` to check
32# alignment of pointers, this *may* improve codegen in some cases (but it has
33# never been formally benchmarked!)
34align_offset = []
35
36min_const_generics = [] # MSRV 1.51: support arrays via min_const_generics
37
38wasm_simd = [] # MSRV 1.54.0: support wasm simd types
39aarch64_simd = [] # MSRV 1.59.0: support aarch64 simd types
40avx512_simd = [] # MSRV 1.72.0: support avx512 simd types
41
42must_cast = [] # MSRV 1.64.0: support the `must` module.
43must_cast_extra = ["must_cast"] # MSRV 1.83.0: support mutable references in const
44
45# Adds `TransparentWrapper` impls for stdlib types newer than bytemuck's base MSRV.
46# Current MSRV 1.74.0: `core::num::Saturating`.
47# MSRV may increase if impls are added for newer types.
48transparentwrapper_extra = []
49
50const_zeroed = [] # MSRV 1.75.0: support const `zeroed()`
51
52# MSRV 1.82.0: support `zeroed_*rc*` when combined with `extern_crate_alloc`
53alloc_uninit = []
54
55# Do not use if you can avoid it, because this is **unsound**!!!!
56unsound_ptr_pod_impl = []
57
58# MSRV 1.46.0: adds the `#[track_caller]` attribute to functions which may panic
59track_caller = []
60
61# MSRV 1.74.0 Pod/Zeroable implementations for `core::num::Saturating`
62pod_saturating = []
63
64# Enables all features that are both sound and supported on the latest stable
65# version of Rust, with the exception of `extern_crate_alloc` and
66# `extern_crate_std`.
67# Note: Enabling this feature opts out of any MSRV guarantees!
68latest_stable_rust = [
69 # Keep this list sorted.
70 "aarch64_simd",
71 "avx512_simd",
72 "align_offset",
73 "alloc_uninit",
74 "const_zeroed",
75 "derive",
76 "min_const_generics",
77 "must_cast",
78 "must_cast_extra",
79 "pod_saturating",
80 "track_caller",
81 "transparentwrapper_extra",
82 "wasm_simd",
83 "zeroable_atomics",
84 "zeroable_maybe_uninit",
85]
86
87# ALL FEATURES BELOW THIS ARE NOT SEMVER SUPPORTED! TEMPORARY ONLY!
88
89# Enable support for `std::simd` types.
90nightly_portable_simd = []
91# Enable support for unstable `std::arch` types (such as the AVX512 types).
92nightly_stdsimd = []
93# Enable `f16` and `f128`
94nightly_float = []
95
96# Improved documentation using the nightly toolchain
97nightly_docs = []
98
99[dependencies]
100bytemuck_derive = { version = "1.4.1", path = "derive", optional = true }
101
102[lints.rust]
103unexpected_cfgs = { level = "deny", check-cfg = ['cfg(target_arch, values("spirv"))'] }
104
105[package.metadata.docs.rs]
106# Note(Lokathor): Don't use all-features or it would use `unsound_ptr_pod_impl` too.
107features = [
108 "nightly_docs",
109 "latest_stable_rust",
110 "extern_crate_alloc",
111 "extern_crate_std",
112]
113
114[package.metadata.playground]
115# Note(Lokathor): Don't use all-features or it would use `unsound_ptr_pod_impl` too.
116features = [
117 "latest_stable_rust",
118 "extern_crate_alloc",
119 "extern_crate_std",
120]
121