Skip to content

Commit

Permalink
replaced bytecheck with rkyv-validation feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mkatychev committed Feb 13, 2023
1 parent cb958c3 commit 27ca8dd
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ std = []
clock = ["std", "winapi", "iana-time-zone"]
oldtime = ["time"]
wasmbind = ["wasm-bindgen", "js-sys"]
bytecheck = ["dep:bytecheck", "rkyv?/validation"]
rkyv-validation = ["rkyv/validation", "dep:bytecheck"]
unstable-locales = ["pure-rust-locales", "alloc"]
__internal_bench = ["criterion"]
__doctest = []
Expand Down
6 changes: 3 additions & 3 deletions src/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use core::cmp::Ordering;
use core::ops::{Add, AddAssign, Sub, SubAssign};
use core::{fmt, hash};

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};
Expand Down Expand Up @@ -59,7 +59,7 @@ use crate::{Datelike, Weekday};
#[deprecated(since = "0.4.23", note = "Use `NaiveDate` or `DateTime<Tz>` instead")]
#[derive(Clone)]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes)))]
pub struct Date<Tz: TimeZone> {
date: NaiveDate,
offset: Tz::Offset,
Expand Down Expand Up @@ -527,7 +527,7 @@ impl<Tz: TimeZone> fmt::Debug for Date<Tz> {

// This boilerplate is a shortcoming of the `Derive` macro.
// See: https://github.com/rkyv/rkyv/issues/333
#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
impl<Tz: TimeZone> fmt::Debug for ArchivedDate<Tz>
where
Tz: Archive,
Expand Down
6 changes: 3 additions & 3 deletions src/datetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::Date;
use crate::Months;
use crate::{Datelike, Timelike, Weekday};

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};
Expand Down Expand Up @@ -88,7 +88,7 @@ pub enum SecondsFormat {
/// [`TimeZone`](./offset/trait.TimeZone.html) implementations.
#[derive(Clone)]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes)))]
pub struct DateTime<Tz: TimeZone> {
datetime: NaiveDateTime,
offset: Tz::Offset,
Expand Down Expand Up @@ -994,7 +994,7 @@ impl<Tz: TimeZone> fmt::Debug for DateTime<Tz> {

// This boilerplate is a shortcoming of the `Derive` macro.
// See: https://github.com/rkyv/rkyv/issues/333
#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
impl<Tz: TimeZone> fmt::Debug for ArchivedDateTime<Tz>
where
Tz: Archive,
Expand Down
4 changes: 2 additions & 2 deletions src/month.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::fmt;

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};
Expand Down Expand Up @@ -32,7 +32,7 @@ use rkyv::{Archive, Deserialize, Serialize};
#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]
#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub enum Month {
/// January
Expand Down
4 changes: 2 additions & 2 deletions src/naive/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use core::convert::TryFrom;
use core::ops::{Add, AddAssign, RangeInclusive, Sub, SubAssign};
use core::{fmt, str};

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
use num_integer::div_mod_floor;
use num_traits::ToPrimitive;
Expand Down Expand Up @@ -188,7 +188,7 @@ impl Days {
/// This is currently the internal format of Chrono's date types.
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Copy, Clone)]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes, Debug)))]
pub struct NaiveDate {
ymdf: DateImpl, // (year << 13) | of
}
Expand Down
4 changes: 2 additions & 2 deletions src/naive/datetime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use core::fmt::Write;
use core::ops::{Add, AddAssign, Sub, SubAssign};
use core::{fmt, str};

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
use num_integer::div_mod_floor;
use num_traits::ToPrimitive;
Expand Down Expand Up @@ -83,7 +83,7 @@ pub const MAX_DATETIME: NaiveDateTime = NaiveDateTime::MAX;
/// ```
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Copy, Clone)]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct NaiveDateTime {
date: NaiveDate,
Expand Down
4 changes: 2 additions & 2 deletions src/naive/isoweek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::fmt;

use super::internals::{DateImpl, Of, YearFlags};

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};
Expand All @@ -20,7 +20,7 @@ use rkyv::{Archive, Deserialize, Serialize};
/// via the [`Datelike::iso_week`](../trait.Datelike.html#tymethod.iso_week) method.
#[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone)]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes, Debug)))]
pub struct IsoWeek {
// note that this allows for larger year range than `NaiveDate`.
// this is crucial because we have an edge case for the first and last week supported,
Expand Down
4 changes: 2 additions & 2 deletions src/naive/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use core::borrow::Borrow;
use core::ops::{Add, AddAssign, Sub, SubAssign};
use core::{fmt, str};

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
use num_integer::div_mod_floor;
#[cfg(feature = "rkyv")]
Expand Down Expand Up @@ -191,7 +191,7 @@ mod tests;
/// **there is absolutely no guarantee that the leap second read has actually happened**.
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Copy, Clone)]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes, Debug)))]
pub struct NaiveTime {
secs: u32,
frac: u32,
Expand Down
4 changes: 2 additions & 2 deletions src/offset/fixed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use core::fmt;
use core::ops::{Add, Sub};

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
use num_integer::div_mod_floor;
#[cfg(feature = "rkyv")]
Expand All @@ -26,7 +26,7 @@ use crate::Timelike;
/// [`west_opt`](#method.west_opt) methods for examples.
#[derive(PartialEq, Eq, Hash, Copy, Clone)]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes, Debug)))]
pub struct FixedOffset {
local_minus_utc: i32,
}
Expand Down
4 changes: 2 additions & 2 deletions src/offset/local/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

//! The local (system) time zone.

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};
Expand Down Expand Up @@ -55,7 +55,7 @@ mod tz_info;
/// ```
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct Local;

Expand Down
4 changes: 2 additions & 2 deletions src/offset/utc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use core::fmt;
))]
use std::time::{SystemTime, UNIX_EPOCH};

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};
Expand Down Expand Up @@ -44,7 +44,7 @@ use crate::{Date, DateTime};
/// ```
#[derive(Copy, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct Utc;

Expand Down
4 changes: 2 additions & 2 deletions src/oldtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use core::{fmt, i64};
#[cfg(any(feature = "std", test))]
use std::error::Error;

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};
Expand Down Expand Up @@ -54,7 +54,7 @@ macro_rules! try_opt {
/// This also allows for the negative duration; see individual methods for details.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes, Debug)))]
pub struct Duration {
secs: i64,
nanos: i32, // Always 0 <= nanos < NANOS_PER_SEC
Expand Down
4 changes: 2 additions & 2 deletions src/weekday.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::fmt;

#[cfg(all(feature = "bytecheck", feature = "rkyv"))]
#[cfg(feature = "rkyv-validation")]
use bytecheck::CheckBytes;
#[cfg(feature = "rkyv")]
use rkyv::{Archive, Deserialize, Serialize};
Expand All @@ -13,7 +13,7 @@ use rkyv::{Archive, Deserialize, Serialize};
#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]
#[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
#[cfg_attr(feature = "rkyv", derive(Archive, Deserialize, Serialize), archive(compare(PartialEq)))]
#[cfg_attr(all(feature = "bytecheck", feature = "rkyv"), archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "rkyv-validation", archive_attr(derive(CheckBytes, Debug)))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub enum Weekday {
/// Monday.
Expand Down

0 comments on commit 27ca8dd

Please sign in to comment.