From 5ad5c2391931482fd507e9c8a4924f4f74dd4a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Fri, 24 May 2024 15:53:34 +0200 Subject: [PATCH] docs: elaborate on differences to other crates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- README.md | 6 ++++++ src/lib.rs | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c36a737..120fc7e 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,14 @@ This crate provides the [`Be`] (big-endian) and [`Le`] (little-endian) byte-order-aware numeric types. +Unlike the popular [`byteorder`] crate, which focuses on the action of encoding and decoding numbers to and from byte streams, this crate focuses on the state of numbers. +This is useful to create structs that contain fields of a specific endianness for interoperability, such as in virtio. +In comparison to other crates that focus on state, this crate closely follows naming conventions from [`core::num`], has rich functionality, and extensive documentation of each method. + [`Be`]: https://docs.rs/endian-num/latest/endian_num/struct.Be.html [`Le`]: https://docs.rs/endian-num/latest/endian_num/struct.Le.html +[`byteorder`]: https://docs.rs/byteorder +[`core::num`]: https://doc.rust-lang.org/stable/core/num/index.html The core API looks _roughly_ like this (correspondingly for `Be`): diff --git a/src/lib.rs b/src/lib.rs index f563cc0..c795fe7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,11 +2,11 @@ //! //! This crate provides the [`Be`] (big-endian) and [`Le`] (little-endian) byte-order-aware numeric types. //! -//! The types aim to provide a similar API to other numeric types from [`core::num`], such as [`NonZero`], [`Saturating`], and [`Wrapping`]. +//! Unlike the popular [`byteorder`] crate, which focuses on the action of encoding and decoding numbers to and from byte streams, this crate focuses on the state of numbers. +//! This is useful to create structs that contain fields of a specific endianness for interoperability, such as in virtio. +//! In comparison to other crates that focus on state, this crate closely follows naming conventions from [`core::num`], has rich functionality, and extensive documentation of each method. //! -//! [`NonZero`]: core::num::NonZero -//! [`Saturating`]: core::num::Saturating -//! [`Wrapping`]: core::num::Wrapping +//! [`byteorder`]: https://docs.rs/byteorder //! //! The core API looks _roughly_ like this (correspondingly for `Be`): //!