| 1 |
# Copyright 2018 The Fuchsia Authors |
| 2 |
# |
| 3 |
# Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0 |
| 4 |
# <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT |
| 5 |
# license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. |
| 6 |
# This file may not be copied, modified, or distributed except according to |
| 7 |
# those terms. |
| 8 |
|
| 9 |
# Put both crates in a single workspace so that `trybuild` compiler errors have |
| 10 |
# paths that are stable regardless of the path to the repository root. This |
| 11 |
# avoids issues like: |
| 12 |
# https://github.com/dtolnay/trybuild/issues/207#issuecomment-131227.594 |
| 13 |
[workspace] |
| 14 |
|
| 15 |
[package] |
| 16 |
edition = "2021" |
| 17 |
name = "zerocopy" |
| 18 |
version = "0.8.27" |
| 19 |
authors = ["Joshua Liebow-Feeser <[email protected]>", "Jack Wrenn <[email protected]>"] |
| 20 |
description = "Zerocopy makes zero-cost memory manipulation effortless. We write \"unsafe\" so you don't have to." |
| 21 |
categories = ["embedded", "encoding", "no-std::no-alloc", "parsing", "rust-patterns"] |
| 22 |
keywords = ["cast", "convert", "transmute", "transmutation", "type-punning"] |
| 23 |
license = "BSD-2-Clause OR Apache-2.0 OR MIT" |
| 24 |
repository = "https://github.com/google/zerocopy" |
| 25 |
rust-version = "1.56.0" |
| 26 |
|
| 27 |
exclude = [".*"] |
| 28 |
|
| 29 |
[package.metadata.build-rs] |
| 30 |
# These key/value pairs are parsed by `build.rs`. Each entry names a `--cfg` |
| 31 |
# which will be emitted if zerocopy is built with a toolchain version at least |
| 32 |
# as high as the specified version. In the emitted `--cfg`, dashes are replaced |
| 33 |
# by underscores. |
| 34 |
# |
| 35 |
# Each name is suffixed with the version it corresponds to. This is a convention |
| 36 |
# used in the codebase to make it less likely for us to make mistakes when |
| 37 |
# writing `doc_cfg` attributes. |
| 38 |
|
| 39 |
# From 1.81.0, Rust supports the `core::error::Error` trait. |
| 40 |
zerocopy-core-error-1-81-0 = "1.81.0" |
| 41 |
|
| 42 |
# From 1.78.0, Rust supports the `#[diagnostic::on_unimplemented]` attribute. |
| 43 |
zerocopy-diagnostic-on-unimplemented-1-78-0 = "1.78.0" |
| 44 |
|
| 45 |
# From 1.61.0, Rust supports generic types with trait bounds in `const fn`. |
| 46 |
zerocopy-generic-bounds-in-const-fn-1-61-0 = "1.61.0" |
| 47 |
|
| 48 |
# From 1.60.0, Rust supports `cfg(target_has_atomics)`, which allows us to |
| 49 |
# detect whether a target supports particular sets of atomics. |
| 50 |
zerocopy-target-has-atomics-1-60-0 = "1.60.0" |
| 51 |
|
| 52 |
# When the "simd" feature is enabled, include SIMD types from the |
| 53 |
# `core::arch::aarch64` module, which was stabilized in 1.59.0. On earlier Rust |
| 54 |
# versions, these types require the "simd-nightly" feature. |
| 55 |
zerocopy-aarch64-simd-1-59-0 = "1.59.0" |
| 56 |
|
| 57 |
# Permit panicking in `const fn`s and calling `Vec::try_reserve`. |
| 58 |
zerocopy-panic-in-const-and-vec-try-reserve-1-57-0 = "1.57.0" |
| 59 |
|
| 60 |
[package.metadata.ci] |
| 61 |
# The versions of the stable and nightly compiler toolchains to use in CI. |
| 62 |
pinned-stable = "1.89.0" |
| 63 |
pinned-nightly = "nightly-2025-09-05" |
| 64 |
|
| 65 |
[package.metadata.docs.rs] |
| 66 |
all-features = true |
| 67 |
rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"] |
| 68 |
|
| 69 |
[package.metadata.playground] |
| 70 |
features = ["__internal_use_only_features_that_work_on_stable"] |
| 71 |
|
| 72 |
[features] |
| 73 |
alloc = [] |
| 74 |
derive = ["zerocopy-derive"] |
| 75 |
simd = [] |
| 76 |
simd-nightly = ["simd"] |
| 77 |
float-nightly = [] |
| 78 |
std = ["alloc"] |
| 79 |
# This feature depends on all other features that work on the stable compiler. |
| 80 |
# We make no stability guarantees about this feature; it may be modified or |
| 81 |
# removed at any time. |
| 82 |
__internal_use_only_features_that_work_on_stable = ["alloc", "derive", "simd", "std"] |
| 83 |
|
| 84 |
[dependencies] |
| 85 |
zerocopy-derive = { version = "=0.8.27", path = "zerocopy-derive", optional = true } |
| 86 |
|
| 87 |
# The "associated proc macro pattern" ensures that the versions of zerocopy and |
| 88 |
# zerocopy-derive remain equal, even if the 'derive' feature isn't used. |
| 89 |
# See: https://github.com/matklad/macro-dep-test |
| 90 |
[target.'cfg(any())'.dependencies] |
| 91 |
zerocopy-derive = { version = "=0.8.27", path = "zerocopy-derive" } |
| 92 |
|
| 93 |
[dev-dependencies] |
| 94 |
# More recent versions of `either` have an MSRV higher than ours. |
| 95 |
either = "=1.13.0" |
| 96 |
# FIXME(#381) Remove this dependency once we have our own layout gadgets. |
| 97 |
elain = "0.3.0" |
| 98 |
# More recent versions of `glob` have an MSRV higher than ours. |
| 99 |
glob = "=0.3.2" |
| 100 |
itertools = "0.11" |
| 101 |
rand = { version = "0.8.5", default-features = false, features = ["small_rng"] } |
| 102 |
rustversion = "1.0" |
| 103 |
static_assertions = "1.1" |
| 104 |
testutil = { path = "testutil" } |
| 105 |
# Pinned to a specific version so that the version used for local development |
| 106 |
# and the version used in CI are guaranteed to be the same. Future versions |
| 107 |
# sometimes change the output format slightly, so a version mismatch can cause |
| 108 |
# CI test failures. |
| 109 |
trybuild = { version = "=1.0.89", features = ["diff"] } |
| 110 |
# In tests, unlike in production, zerocopy-derive is not optional |
| 111 |
zerocopy-derive = { version = "=0.8.27", path = "zerocopy-derive" } |