Rename serde_impl to serde.

This commit is contained in:
Stephen Chung 2021-02-19 15:17:14 +08:00
parent bd5ff457d2
commit b789c319e7
9 changed files with 19 additions and 22 deletions

View File

@ -79,8 +79,6 @@ mod parser;
pub mod plugin;
mod result;
mod scope;
#[cfg(feature = "serde")]
mod serde_impl;
mod stdlib;
mod syntax;
mod token;
@ -168,13 +166,8 @@ pub use module::ModuleResolver;
#[cfg(not(feature = "no_module"))]
pub use module::resolvers as module_resolvers;
/// _(SERDE)_ Serialization and deserialization support for [`serde`](https://crates.io/crates/serde).
/// Exported under the `serde` feature.
#[cfg(feature = "serde")]
pub mod serde {
pub use super::serde_impl::de::from_dynamic;
pub use super::serde_impl::ser::to_dynamic;
}
pub mod serde;
#[cfg(not(feature = "no_optimize"))]
pub use optimize::OptimizationLevel;

View File

@ -17,7 +17,7 @@ use crate::Map;
///
/// The reference is necessary because the deserialized type may hold references
/// (especially `&str`) to the source [`Dynamic`][crate::Dynamic].
pub struct DynamicDeserializer<'a> {
struct DynamicDeserializer<'a> {
value: &'a Dynamic,
}

14
src/serde/mod.rs Normal file
View File

@ -0,0 +1,14 @@
//! _(SERDE)_ Serialization and deserialization support for [`serde`](https://crates.io/crates/serde).
//! Exported under the `serde` feature only.
mod de;
mod deserialize;
mod ser;
mod serialize;
mod str;
#[cfg(feature = "metadata")]
mod metadata;
pub use de::from_dynamic;
pub use ser::to_dynamic;

View File

@ -14,7 +14,7 @@ use crate::Array;
use crate::Map;
/// Serializer for [`Dynamic`][crate::Dynamic] which is kept as a reference.
pub struct DynamicSerializer {
struct DynamicSerializer {
/// Buffer to hold a temporary key.
_key: Dynamic,
/// Buffer to hold a temporary value.
@ -639,7 +639,7 @@ impl SerializeStruct for DynamicSerializer {
}
#[cfg(not(any(feature = "no_object", feature = "no_index")))]
pub struct TupleVariantSerializer {
struct TupleVariantSerializer {
variant: &'static str,
array: Array,
}
@ -664,7 +664,7 @@ impl serde::ser::SerializeTupleVariant for TupleVariantSerializer {
}
#[cfg(not(feature = "no_object"))]
pub struct StructVariantSerializer {
struct StructVariantSerializer {
variant: &'static str,
map: Map,
}

View File

@ -1,10 +0,0 @@
//! Helper module defining serialization/deserialization support for [`serde`].
pub mod de;
mod deserialize;
pub mod ser;
mod serialize;
mod str;
#[cfg(feature = "metadata")]
pub mod metadata;