From 4d62314c1e2dac715777c5eb4d4bd6e125cc8e62 Mon Sep 17 00:00:00 2001 From: David Koloski Date: Mon, 21 Jun 2021 09:05:06 -0400 Subject: [PATCH] Release 0.6.0 --- bytecheck/Cargo.toml | 7 +++---- bytecheck/src/lib.rs | 28 ---------------------------- bytecheck_derive/Cargo.toml | 2 +- bytecheck_test/Cargo.toml | 7 +++---- 4 files changed, 7 insertions(+), 37 deletions(-) diff --git a/bytecheck/Cargo.toml b/bytecheck/Cargo.toml index 086ba5e..ef3ebd6 100644 --- a/bytecheck/Cargo.toml +++ b/bytecheck/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bytecheck" -version = "0.5.2" +version = "0.6.0" authors = ["David Koloski "] edition = "2018" description = "Derive macro for bytecheck" @@ -14,7 +14,7 @@ readme = "crates-io.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bytecheck_derive = { version = "=0.5.2", path = "../bytecheck_derive", default-features = false } +bytecheck_derive = { version = "=0.6.0", path = "../bytecheck_derive", default-features = false } ptr_meta = "0.1" simdutf8 = { version = "0.1", default-features = false } @@ -28,7 +28,6 @@ simdutf8 = { version = "0.1", default-features = false } uuid = { version = "0.8", optional = true } [features] -default = ["const_generics", "std"] -const_generics = [] +default = ["std"] verbose = [] std = ["bytecheck_derive/std", "simdutf8/std"] diff --git a/bytecheck/src/lib.rs b/bytecheck/src/lib.rs index b0ab6d5..6594831 100644 --- a/bytecheck/src/lib.rs +++ b/bytecheck/src/lib.rs @@ -86,8 +86,6 @@ //! //! ## Features //! -//! - `const_generics`: Extends the implementations of [`CheckBytes`] to all arrays and not just -//! arrays up to length 32 (enabled by default). //! - `verbose`: Some validation algorithms are optimized for speed and do not report full error //! details by default. This feature provides full error information. //! - `std`: Enables standard library support (enabled by default). If the `std` feature is not @@ -436,32 +434,6 @@ impl fmt::Display for ArrayCheckError { #[cfg(feature = "std")] impl std::error::Error for ArrayCheckError {} -#[cfg(not(feature = "const_generics"))] -macro_rules! impl_array { - () => {}; - ($len:expr, $($rest:expr,)*) => { - impl, C: ?Sized> CheckBytes for [T; $len] { - type Error = ArrayCheckError; - - #[inline] - unsafe fn check_bytes<'a>(value: *const Self, context: &mut C) -> Result<&'a Self, Self::Error> { - #[allow(clippy::reversed_empty_ranges)] - for index in 0..$len { - let el = value.cast::().add(index); - T::check_bytes(el, context).map_err(|error| ArrayCheckError { index, error })?; - } - Ok(&*value) - } - } - - impl_array! { $($rest,)* } - }; -} - -#[cfg(not(feature = "const_generics"))] -impl_array! { 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, } - -#[cfg(feature = "const_generics")] impl, C: ?Sized, const N: usize> CheckBytes for [T; N] { type Error = ArrayCheckError; diff --git a/bytecheck_derive/Cargo.toml b/bytecheck_derive/Cargo.toml index 5539a37..247fe61 100644 --- a/bytecheck_derive/Cargo.toml +++ b/bytecheck_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bytecheck_derive" -version = "0.5.2" +version = "0.6.0" authors = ["David Koloski "] edition = "2018" description = "Derive macro for bytecheck" diff --git a/bytecheck_test/Cargo.toml b/bytecheck_test/Cargo.toml index 460a07e..0e50c69 100644 --- a/bytecheck_test/Cargo.toml +++ b/bytecheck_test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bytecheck_test" -version = "0.5.0" +version = "0.6.0" authors = ["David Koloski "] edition = "2018" description = "Test suite for bytecheck crates" @@ -10,10 +10,9 @@ repository = "https://github.com/djkoloski/bytecheck" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bytecheck = { version = "0.5", path = "../bytecheck", default-features = false } +bytecheck = { version = "0.6", path = "../bytecheck", default-features = false } [features] -default = ["const_generics", "std"] -const_generics = ["bytecheck/const_generics"] +default = ["std"] verbose = ["bytecheck/verbose"] std = ["bytecheck/std"]