Skip to content

Commit 88161ae

Browse files
committed
[byteorder] Remove byteorder feature and crate dep
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
1 parent b3b15e7 commit 88161ae

File tree

5 files changed

+278
-88
lines changed

5 files changed

+278
-88
lines changed

Cargo.toml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ pinned-nightly = "nightly-2023-12-05"
3737
features = ["__internal_use_only_features_that_work_on_stable"]
3838

3939
[features]
40-
default = ["byteorder"]
41-
4240
alloc = []
41+
# Do not enable this feature; it will cause compilation to fail. It exists to
42+
# provide more helpful error messages for crates updating from a previous
43+
# version which provided this feature.
44+
byteorder = []
4345
derive = ["zerocopy-derive"]
4446
simd = []
4547
simd-nightly = ["simd"]
@@ -51,11 +53,6 @@ __internal_use_only_features_that_work_on_stable = ["alloc", "derive", "simd"]
5153
[dependencies]
5254
zerocopy-derive = { version = "=0.8.0-alpha", path = "zerocopy-derive", optional = true }
5355

54-
[dependencies.byteorder]
55-
version = "1.3"
56-
default-features = false
57-
optional = true
58-
5956
# The "associated proc macro pattern" ensures that the versions of zerocopy and
6057
# zerocopy-derive remain equal, even if the 'derive' feature isn't used.
6158
# See: https://github.com/matklad/macro-dep-test

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,6 @@ for network parsing.
4949
the `alloc` crate is added as a dependency, and some allocation-related
5050
functionality is added.
5151

52-
- **`byteorder`** (enabled by default)
53-
Adds the `byteorder` module and a dependency on the `byteorder` crate.
54-
The `byteorder` module provides byte order-aware equivalents of the
55-
multi-byte primitive numerical types. Unlike their primitive equivalents,
56-
the types in this module have no alignment requirement and support byte
57-
order conversions. This can be useful in handling file formats, network
58-
packet layouts, etc which don't provide alignment guarantees and which may
59-
use a byte order different from that of the execution platform.
60-
6152
- **`derive`**
6253
Provides derives for the core marker traits via the `zerocopy-derive`
6354
crate. These derives are re-exported from `zerocopy`, so it is not

0 commit comments

Comments
 (0)