diff --git a/tardis/src/basic/tracing.rs b/tardis/src/basic/tracing.rs index a6e7c07a..0fb3e62f 100644 --- a/tardis/src/basic/tracing.rs +++ b/tardis/src/basic/tracing.rs @@ -3,10 +3,10 @@ use std::sync::Once; use crate::basic::result::TardisResult; use crate::config::config_dto::LogConfig; -use crate::TARDIS_INST; - #[allow(unused_imports)] use crate::consts::*; +use crate::TARDIS_INST; +pub use tracing_subscriber::filter::Directive; use tracing_subscriber::layer::Layered; use tracing_subscriber::util::SubscriberInitExt; use tracing_subscriber::EnvFilter; diff --git a/tardis/src/web/web_resp.rs b/tardis/src/web/web_resp.rs index 484baf49..11782492 100644 --- a/tardis/src/web/web_resp.rs +++ b/tardis/src/web/web_resp.rs @@ -131,5 +131,18 @@ where pub records: Vec, } -#[derive(Object, Deserialize, Serialize, Clone, Debug, Default, Copy)] +#[derive(Object, Serialize, Clone, Debug, Default, Copy)] +/// This `Void` is for represent an empty value. +/// Any value can be deserialized as `Void`. +/// Void will be serialized as json's `null`. pub struct Void; +impl<'de> Deserialize<'de> for Void { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + // ignore this value whatever + let _ = deserializer.deserialize_any(serde::de::IgnoredAny)?; + Ok(Void) + } +}