fix(apb): node.into::<Value>() -> node.into_inner()
This commit is contained in:
parent
6793f0fdc9
commit
12073bfed4
2 changed files with 15 additions and 1 deletions
|
@ -311,7 +311,7 @@ pub fn set_maybe_node(obj: &mut serde_json::Value, key: &str, node: crate::Node<
|
|||
if node.is_nothing() {
|
||||
set_maybe_value(obj, key, None)
|
||||
} else {
|
||||
set_maybe_value(obj, key, Some(node.into()))
|
||||
set_maybe_value(obj, key, Some(node.into_inner()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -133,6 +133,20 @@ impl<T : super::Base> Node<T> {
|
|||
|
||||
#[cfg(feature = "unstructured")]
|
||||
impl Node<serde_json::Value> {
|
||||
pub fn into_inner(self) -> serde_json::Value {
|
||||
match self {
|
||||
Self::Object(x) => *x,
|
||||
Self::Link(l) => serde_json::Value::String(l.href().unwrap_or_default().to_string()),
|
||||
Self::Empty => serde_json::Value::Null,
|
||||
Self::Array(arr) => serde_json::Value::Array(
|
||||
arr
|
||||
.into_iter()
|
||||
.map(|x| x.into_inner())
|
||||
.collect()
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn link(uri: String) -> Self {
|
||||
Node::Link(Box::new(uri))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue