Lines Matching full:zerocopy
20 //! Zerocopy makes zero-cost memory manipulation effortless. We write `unsafe`
23 //! *For an overview of what's changed from zerocopy 0.7, check out our [release
26 //! *Have questions? Need more out of zerocopy? Submit a [customer request
30 //! [customer-request-issue]: https://github.com/google/zerocopy/issues/new/choose
31 //! [release-notes]: https://github.com/google/zerocopy/discussions/1680
32 //! [github-q-a]: https://github.com/google/zerocopy/discussions/categories/q-a
39 //! Zerocopy provides four derivable traits for zero-cost conversions:
55 //! Zerocopy provides three derivable marker traits that do not provide any
58 //! - [`KnownLayout`] indicates that zerocopy can reason about certain layout
68 //! Zerocopy provides six macros for safe casting between types:
88 //! Zerocopy provides byte-order aware integer types that support these
95 //! By default, `zerocopy` is `no_std`. When the `alloc` feature is enabled,
100 //! By default, `zerocopy` is `no_std`. When the `std` feature is enabled, the
105 //! Provides derives for the core marker traits via the `zerocopy-derive`
106 //! crate. These derives are re-exported from `zerocopy`, so it is not
107 //! necessary to depend on `zerocopy-derive` directly.
110 //! depend on both `zerocopy` and `zerocopy-derive` in your `Cargo.toml`,
117 //! zerocopy = "0.X"
118 //! zerocopy-derive = "0.X"
122 //! one of your dependencies enables zerocopy's `derive` feature, import
143 //! [duplicate-import-errors]: https://github.com/google/zerocopy/issues/1587
150 //! Upgrades `#[inline]` to `#[inline(always)]` on many of zerocopy's public
152 //! *may* improve the optimization of hot paths using zerocopy without the broad
157 //! Zerocopy is expressly designed for use in security-critical contexts. We
158 //! strive to ensure that that zerocopy code is sound under Rust's current
166 //! We run tests using [Miri], ensuring that zerocopy is sound across a wide
170 //! We apply formal verification tools like [Kani][kani] to prove zerocopy's
177 //! [soundness policy]: https://github.com/google/zerocopy/blob/main/zerocopy/POLICIES.md#soundness
183 //! with crates like zerocopy to identify aspects of safer transmutation that
187 //! another type. Once this functionality is sufficiently mature, zerocopy
190 //! an implementation detail that is invisible to zerocopy's users.
192 //! Project Safe Transmute will not replace the need for most of zerocopy's
195 //! `unsafe` code altogether. For the foreseeable future, crates like zerocopy
206 //! [MSRV policy]: https://github.com/google/zerocopy/blob/main/zerocopy/POLICIES.md#msrv
210 //! Zerocopy uses [GitHub Releases].
212 //! [GitHub Releases]: https://github.com/google/zerocopy/releases
216 //! Zerocopy is maintained by engineers at Google with help from [many wonderful
220 //! [contributors]: https://github.com/google/zerocopy/graphs/contributors
335 // This is a hack to allow zerocopy-derive derives to work in this crate. They
336 // assume that zerocopy is linked as an extern crate, so they access items from
337 // it as `zerocopy::Xxx`. This makes that still work.
339 extern crate self as zerocopy;
355 // This module is `pub` so that zerocopy's error types and error handling
431 …#[deprecated = "Development of zerocopy using cargo is not supported. Please use `cargo.sh` or `wi…
443 /// some of zerocopy's APIs. It can be applied to structs, enums, and unions;
481 /// use zerocopy::*;
520 /// use zerocopy::*;
544 // zerocopy. On our MSRV toolchain, the error messages read, for example:
549 // 1 | use zerocopy::FromZeroes;
553 // --> /Users/josh/workspace/zerocopy/src/lib.rs:1845:5
563 /// Indicates that zerocopy can reason about certain aspects of a type's layout.
565 /// This trait is required by many of zerocopy's APIs. It supports sized types,
709 /// There are two places in zerocopy's API that we refer to "a valid size" of a
741 /// releases of zerocopy may make backwards-breaking changes to these items,
748 …doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.…
856 /// use zerocopy::KnownLayout;
1223 /// - If `f` has name `n`, `FIELD_ID` is `zerocopy::ident_id!(n)`; otherwise,
1224 /// if `f` is at index `i`, `FIELD_ID` is `zerocopy::ident_id!(i)`.
1568 …doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.…
1569 …doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocop…
1647 /// [`bool`] is `TryFromBytes`, so zerocopy can transmute a [`u8`] into a
1700 /// Zerocopy takes a conservative approach, and only considers a bit pattern to
1705 /// intuitions about what ought to be valid. As a result, zerocopy's
1728 /// Future releases of zerocopy may make backwards-breaking changes to these
1733 /// [github-repo]: https://github.com/google/zerocopy
1739 …doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.…
1802 /// use zerocopy::*;
1818 /// use zerocopy::TryFromBytes;
1923 /// use zerocopy::*;
1939 /// use zerocopy::TryFromBytes;
2033 /// use zerocopy::*;
2049 /// use zerocopy::TryFromBytes;
2143 /// use zerocopy::*;
2160 /// use zerocopy::TryFromBytes;
2249 /// use zerocopy::*;
2266 /// use zerocopy::TryFromBytes;
2349 /// use zerocopy::*;
2366 /// use zerocopy::TryFromBytes;
2441 /// use zerocopy::TryFromBytes;
2482 /// use zerocopy::*;
2561 /// use zerocopy::TryFromBytes;
2603 /// use zerocopy::*;
2669 /// use zerocopy::TryFromBytes;
2711 /// use zerocopy::*;
2775 /// use zerocopy::TryFromBytes;
2820 /// use zerocopy::*;
2884 /// use zerocopy::TryFromBytes;
2931 /// use zerocopy::*;
2984 /// use zerocopy::TryFromBytes;
3031 /// use zerocopy::*;
3073 /// use zerocopy::TryFromBytes;
3108 /// In this version of zerocopy, this method reads the `source` into a
3149 /// use zerocopy::TryFromBytes;
3186 /// In this version of zerocopy, this method reads the `source` into a
3228 /// use zerocopy::TryFromBytes;
3265 /// In this version of zerocopy, this method reads the `source` into a
3460 …doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.…
3461 …doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocop…
3485 /// # use zerocopy::FromZeros;
3555 /// # use zerocopy::FromZeros;
3953 /// use zerocopy::FromZeros;
4046 …doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.…
4047 …doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocop…
4083 /// use zerocopy::*;
4099 /// use zerocopy::FromBytes;
4192 /// use zerocopy::*;
4210 /// use zerocopy::FromBytes;
4300 /// use zerocopy::*;
4318 /// use zerocopy::FromBytes;
4392 /// use zerocopy::*;
4411 /// use zerocopy::FromBytes;
4482 /// use zerocopy::*;
4501 /// use zerocopy::FromBytes;
4571 /// use zerocopy::*;
4588 /// use zerocopy::FromBytes;
4643 /// use zerocopy::FromBytes;
4672 /// use zerocopy::*;
4740 /// use zerocopy::FromBytes;
4771 /// use zerocopy::*;
4834 /// use zerocopy::FromBytes;
4865 /// use zerocopy::*;
4928 /// use zerocopy::FromBytes;
4960 /// use zerocopy::*;
5014 /// use zerocopy::FromBytes;
5050 /// use zerocopy::*;
5099 /// use zerocopy::FromBytes;
5135 /// use zerocopy::*;
5175 /// use zerocopy::FromBytes;
5232 /// use zerocopy::FromBytes;
5290 /// use zerocopy::FromBytes;
5341 /// use zerocopy::{byteorder::big_endian::*, FromBytes};
5563 /// zerocopy does not support `#[derive(IntoBytes)]` on unions by default.
5585 /// [discussion]: https://github.com/google/zerocopy/discussions/1802
5679 …doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.…
5680 …doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocop…
5703 /// use zerocopy::IntoBytes;
5783 /// use zerocopy::IntoBytes;
5861 /// use zerocopy::IntoBytes;
5891 /// # use zerocopy::IntoBytes;
5947 /// use zerocopy::IntoBytes;
5977 /// # use zerocopy::IntoBytes;
6035 /// use zerocopy::IntoBytes;
6072 /// # use zerocopy::IntoBytes;
6140 /// use zerocopy::{byteorder::big_endian::U16, FromBytes, IntoBytes};
6161 /// # use zerocopy::IntoBytes;
6319 …doc = concat!("[derive]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocopy/derive.…
6320 …doc = concat!("[derive-analysis]: https://docs.rs/zerocopy/", env!("CARGO_PKG_VERSION"), "/zerocop…