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 Dec 6, 2023
1 parent b3b15e7 commit c330a3c
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 88 deletions.
7 changes: 0 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ pinned-nightly = "nightly-2023-12-05"
features = ["__internal_use_only_features_that_work_on_stable"]

[features]
default = ["byteorder"]

alloc = []
derive = ["zerocopy-derive"]
simd = []
Expand All @@ -51,11 +49,6 @@ __internal_use_only_features_that_work_on_stable = ["alloc", "derive", "simd"]
[dependencies]
zerocopy-derive = { version = "=0.8.0-alpha", 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 c330a3c

Please sign in to comment.