Skip to content

Commit

Permalink
Rename FromZeroes to FromZeros
Browse files Browse the repository at this point in the history
Although both spellings are acceptable, "zeros" is the somewhat more
common [1] spelling of the plural noun "zero". We continue to use
the spelling "zeroes" for the verb; i.e., to replace bytes with the
value `0`. For user convenience, `FromZeroes` is retained as a
deprecated, `doc(hidden)` re-export of `FromZeros`.

Closes #431

[1] https://english.stackexchange.com/questions/3824/what-is-the-plural-form-of-zero/3825#3825
  • Loading branch information
jswrenn committed Dec 7, 2023
1 parent ff58bf6 commit 0cee813
Show file tree
Hide file tree
Showing 37 changed files with 557 additions and 545 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ so you don't have to.
## Overview

Zerocopy provides four core marker traits, each of which can be derived
(e.g., `#[derive(FromZeroes)]`):
- `FromZeroes` indicates that a sequence of zero bytes represents a valid
(e.g., `#[derive(FromZeros)]`):
- `FromZeros` indicates that a sequence of zero bytes represents a valid
instance of a type
- `FromBytes` indicates that a type may safely be converted from an
arbitrary byte sequence
Expand Down Expand Up @@ -76,7 +76,7 @@ for network parsing.
```

- **`simd`**
When the `simd` feature is enabled, `FromZeroes`, `FromBytes`, and
When the `simd` feature is enabled, `FromZeros`, `FromBytes`, and
`AsBytes` impls are emitted for all stable SIMD types which exist on the
target platform. Note that the layout of SIMD types is not yet stabilized,
so these impls may be removed in the future if layout changes make them
Expand Down
10 changes: 5 additions & 5 deletions src/byteorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
//!
//! ```rust,edition2021
//! # #[cfg(feature = "derive")] { // This example uses derives, and won't compile without them
//! use zerocopy::{AsBytes, ByteSlice, FromBytes, FromZeroes, Ref, Unaligned};
//! use zerocopy::{AsBytes, ByteSlice, FromBytes, FromZeros, Ref, Unaligned};
//! use zerocopy::byteorder::network_endian::U16;
//!
//! #[derive(FromZeroes, FromBytes, AsBytes, Unaligned)]
//! #[derive(FromZeros, FromBytes, AsBytes, Unaligned)]
//! #[repr(C)]
//! struct UdpHeader {
//! src_port: U16,
Expand Down Expand Up @@ -276,7 +276,7 @@ example of how it can be used for parsing UDP packets.
[`AsBytes`]: crate::AsBytes
[`Unaligned`]: crate::Unaligned"),
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(any(feature = "derive", test), derive(KnownLayout, NoCell, FromZeroes, FromBytes, AsBytes, Unaligned))]
#[cfg_attr(any(feature = "derive", test), derive(KnownLayout, NoCell, FromZeros, FromBytes, AsBytes, Unaligned))]
#[repr(transparent)]
pub struct $name<O>([u8; $bytes], PhantomData<O>);
}
Expand All @@ -288,10 +288,10 @@ example of how it can be used for parsing UDP packets.
/// SAFETY:
/// `$name<O>` is `repr(transparent)`, and so it has the same layout
/// as its only non-zero field, which is a `u8` array. `u8` arrays
/// are `NoCell`, `FromZeroes`, `FromBytes`, `AsBytes`, and
/// are `NoCell`, `FromZeros`, `FromBytes`, `AsBytes`, and
/// `Unaligned`.
impl_or_verify!(O => NoCell for $name<O>);
impl_or_verify!(O => FromZeroes for $name<O>);
impl_or_verify!(O => FromZeros for $name<O>);
impl_or_verify!(O => FromBytes for $name<O>);
impl_or_verify!(O => AsBytes for $name<O>);
impl_or_verify!(O => Unaligned for $name<O>);
Expand Down
Loading

0 comments on commit 0cee813

Please sign in to comment.