Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export Archived* types in rkyv module #1304

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bincode = { version = "1.3.0" }
wasm-bindgen-test = "0.3"

[package.metadata.docs.rs]
features = ["serde"]
features = ["serde, rkyv"]
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.playground]
Expand Down
20 changes: 20 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,26 @@ pub mod serde {
pub use super::datetime::serde::*;
}

/// Zero-copy serialization/deserialization with rkyv.
///
/// This module re-exports the `Archived*` versions of chrono's types.
#[cfg(feature = "rkyv")]
#[cfg_attr(docsrs, doc(cfg(feature = "rkyv")))]
pub mod rkyv {
pub use crate::datetime::ArchivedDateTime;
pub use crate::duration::ArchivedDuration;
pub use crate::month::ArchivedMonth;
pub use crate::naive::date::ArchivedNaiveDate;
pub use crate::naive::datetime::ArchivedNaiveDateTime;
pub use crate::naive::isoweek::ArchivedIsoWeek;
pub use crate::naive::time::ArchivedNaiveTime;
pub use crate::offset::fixed::ArchivedFixedOffset;
#[cfg(feature = "clock")]
pub use crate::offset::local::ArchivedLocal;
pub use crate::offset::utc::ArchivedUtc;
pub use crate::weekday::ArchivedWeekday;
}

/// Out of range error type used in various converting APIs
#[derive(Clone, Copy, Hash, PartialEq, Eq)]
pub struct OutOfRange {
Expand Down
6 changes: 3 additions & 3 deletions src/naive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
//! (e.g. [`TimeZone`](../offset/trait.TimeZone.html)),
//! but can be also used for the simpler date and time handling.

mod date;
pub(crate) mod date;
pub(crate) mod datetime;
mod internals;
mod isoweek;
mod time;
pub(crate) mod isoweek;
pub(crate) mod time;

pub use self::date::{Days, NaiveDate, NaiveDateDaysIterator, NaiveDateWeeksIterator, NaiveWeek};
#[allow(deprecated)]
Expand Down
6 changes: 3 additions & 3 deletions src/offset/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ use crate::Weekday;
#[allow(deprecated)]
use crate::{Date, DateTime};

mod fixed;
pub(crate) mod fixed;
pub use self::fixed::FixedOffset;

#[cfg(feature = "clock")]
mod local;
pub(crate) mod local;
#[cfg(feature = "clock")]
pub use self::local::Local;

mod utc;
pub(crate) mod utc;
pub use self::utc::Utc;

/// The conversion result from the local time to the timezone-aware datetime types.
Expand Down