deprecate using SerdeValue, SerdeMap and serde_to_value

as they are just wrapper around serde_json::{Value, Map, to_value}.
Instead expose the serde_json and serde crates used.
This commit is contained in:
soruh
2021-12-11 15:59:42 +01:00
committed by Martin Algesten
parent 59f1fab4d3
commit 61e2402045
2 changed files with 21 additions and 4 deletions

View File

@@ -398,8 +398,25 @@ pub use crate::stream::TlsConnector;
// re-export
#[cfg(feature = "cookies")]
pub use cookie::Cookie;
#[cfg(feature = "json")]
pub use serde_json::{to_value as serde_to_value, Map as SerdeMap, Value as SerdeValue};
pub use {serde, serde_json};
#[cfg(feature = "json")]
#[deprecated(note = "use ureq::serde_json::Map instead")]
pub type SerdeMap<K, V> = serde_json::Map<K, V>;
#[cfg(feature = "json")]
#[deprecated(note = "use ureq::serde_json::Value instead")]
pub type SerdeValue = serde_json::Value;
#[cfg(feature = "json")]
#[deprecated(note = "use ureq::serde_json::to_value instead")]
pub fn serde_to_value<T: serde::Serialize>(
value: T,
) -> std::result::Result<serde_json::Value, serde_json::Error> {
serde_json::to_value(value)
}
use once_cell::sync::Lazy;
use std::sync::atomic::{AtomicBool, Ordering};