Skip to content

Commit

Permalink
[byteorder] Remove byteorder feature and crate dep
Browse files Browse the repository at this point in the history
Remove the `byteorder` feature and the dependency on the `byteorder`
crate. Replace the `ByteOrder` trait and types which implement it from
the `byteorder` crate with our own native implementations. This allows
us to make some of our functions and methods `const`.

Add `Usize` and `Isize` byte order-aware types.

Closes #438
  • Loading branch information
joshlf committed Nov 1, 2023
1 parent c8ab908 commit 657fdb9
Show file tree
Hide file tree
Showing 5 changed files with 276 additions and 86 deletions.
11 changes: 4 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ pinned-nightly = "nightly-2023-10-31"
features = ["__internal_use_only_features_that_work_on_stable"]

[features]
default = ["byteorder"]

alloc = []
# Do not enable this feature; it will cause compilation to fail. It exists to
# provide more helpful error messages for crates updating from a previous
# version which provided this feature.
byteorder = []
derive = ["zerocopy-derive"]
simd = []
simd-nightly = ["simd"]
Expand All @@ -50,11 +52,6 @@ __internal_use_only_features_that_work_on_stable = ["alloc", "derive", "simd"]
[dependencies]
zerocopy-derive = { version = "=0.7.21", path = "zerocopy-derive", optional = true }

[dependencies.byteorder]
version = "1.3"
default-features = false
optional = true

# The "associated proc macro pattern" ensures that the versions of zerocopy and
# zerocopy-derive remain equal, even if the 'derive' feature isn't used.
# See: https://github.com/matklad/macro-dep-test
Expand Down
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ for network parsing.
the `alloc` crate is added as a dependency, and some allocation-related
functionality is added.

- **`byteorder`** (enabled by default)
Adds the `byteorder` module and a dependency on the `byteorder` crate.
The `byteorder` module provides byte order-aware equivalents of the
multi-byte primitive numerical types. Unlike their primitive equivalents,
the types in this module have no alignment requirement and support byte
order conversions. This can be useful in handling file formats, network
packet layouts, etc which don't provide alignment guarantees and which may
use a byte order different from that of the execution platform.

- **`derive`**
Provides derives for the core marker traits via the `zerocopy-derive`
crate. These derives are re-exported from `zerocopy`, so it is not
Expand Down
Loading

0 comments on commit 657fdb9

Please sign in to comment.