Skip to content

Commit

Permalink
Release 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
djkoloski committed Jun 21, 2021
1 parent 8fd0e53 commit 4d62314
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 37 deletions.
7 changes: 3 additions & 4 deletions bytecheck/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bytecheck"
version = "0.5.2"
version = "0.6.0"
authors = ["David Koloski <[email protected]>"]
edition = "2018"
description = "Derive macro for bytecheck"
Expand All @@ -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 }

Expand All @@ -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"]
28 changes: 0 additions & 28 deletions bytecheck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -436,32 +434,6 @@ impl<T: fmt::Display> fmt::Display for ArrayCheckError<T> {
#[cfg(feature = "std")]
impl<T: fmt::Debug + fmt::Display> std::error::Error for ArrayCheckError<T> {}

#[cfg(not(feature = "const_generics"))]
macro_rules! impl_array {
() => {};
($len:expr, $($rest:expr,)*) => {
impl<T: CheckBytes<C>, C: ?Sized> CheckBytes<C> for [T; $len] {
type Error = ArrayCheckError<T::Error>;

#[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::<T>().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<T: CheckBytes<C>, C: ?Sized, const N: usize> CheckBytes<C> for [T; N] {
type Error = ArrayCheckError<T::Error>;

Expand Down
2 changes: 1 addition & 1 deletion bytecheck_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bytecheck_derive"
version = "0.5.2"
version = "0.6.0"
authors = ["David Koloski <[email protected]>"]
edition = "2018"
description = "Derive macro for bytecheck"
Expand Down
7 changes: 3 additions & 4 deletions bytecheck_test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bytecheck_test"
version = "0.5.0"
version = "0.6.0"
authors = ["David Koloski <[email protected]>"]
edition = "2018"
description = "Test suite for bytecheck crates"
Expand All @@ -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"]

0 comments on commit 4d62314

Please sign in to comment.