use crate::{JsonMap, JsonValue};
/// 自定义对象 [`JsonValue`] 也就是 [`serde_json::Value`]的功能扩展trait
pub trait JsonValueExt {
/// 将`self`对象转换为一个map option对象
fn into_map_opt(self) -> Option<JsonMap>;
}
impl JsonValueExt for JsonValue {
#[inline]
fn into_map_opt(self) -> Option<JsonMap> {
if let JsonValue::Object(map) = self {
Some(map)
} else {
None
}
}
}