Skip to content

Commit 62ee07e

Browse files
authored
Rename FromZeroes to FromZeros (#430)
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
1 parent b2e872d commit 62ee07e

37 files changed

+557
-545
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ so you don't have to.
2424
## Overview
2525

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

7878
- **`simd`**
79-
When the `simd` feature is enabled, `FromZeroes`, `FromBytes`, and
79+
When the `simd` feature is enabled, `FromZeros`, `FromBytes`, and
8080
`AsBytes` impls are emitted for all stable SIMD types which exist on the
8181
target platform. Note that the layout of SIMD types is not yet stabilized,
8282
so these impls may be removed in the future if layout changes make them

src/byteorder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
//!
3636
//! ```rust,edition2021
3737
//! # #[cfg(feature = "derive")] { // This example uses derives, and won't compile without them
38-
//! use zerocopy::{AsBytes, ByteSlice, FromBytes, FromZeroes, Ref, Unaligned};
38+
//! use zerocopy::{AsBytes, ByteSlice, FromBytes, FromZeros, Ref, Unaligned};
3939
//! use zerocopy::byteorder::network_endian::U16;
4040
//!
41-
//! #[derive(FromZeroes, FromBytes, AsBytes, Unaligned)]
41+
//! #[derive(FromZeros, FromBytes, AsBytes, Unaligned)]
4242
//! #[repr(C)]
4343
//! struct UdpHeader {
4444
//! src_port: U16,
@@ -276,7 +276,7 @@ example of how it can be used for parsing UDP packets.
276276
[`AsBytes`]: crate::AsBytes
277277
[`Unaligned`]: crate::Unaligned"),
278278
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
279-
#[cfg_attr(any(feature = "derive", test), derive(KnownLayout, NoCell, FromZeroes, FromBytes, AsBytes, Unaligned))]
279+
#[cfg_attr(any(feature = "derive", test), derive(KnownLayout, NoCell, FromZeros, FromBytes, AsBytes, Unaligned))]
280280
#[repr(transparent)]
281281
pub struct $name<O>([u8; $bytes], PhantomData<O>);
282282
}
@@ -288,10 +288,10 @@ example of how it can be used for parsing UDP packets.
288288
/// SAFETY:
289289
/// `$name<O>` is `repr(transparent)`, and so it has the same layout
290290
/// as its only non-zero field, which is a `u8` array. `u8` arrays
291-
/// are `NoCell`, `FromZeroes`, `FromBytes`, `AsBytes`, and
291+
/// are `NoCell`, `FromZeros`, `FromBytes`, `AsBytes`, and
292292
/// `Unaligned`.
293293
impl_or_verify!(O => NoCell for $name<O>);
294-
impl_or_verify!(O => FromZeroes for $name<O>);
294+
impl_or_verify!(O => FromZeros for $name<O>);
295295
impl_or_verify!(O => FromBytes for $name<O>);
296296
impl_or_verify!(O => AsBytes for $name<O>);
297297
impl_or_verify!(O => Unaligned for $name<O>);

0 commit comments

Comments
 (0)