diff --git a/src/activitystream/node.rs b/src/activitystream/node.rs index 418fd87..faf4667 100644 --- a/src/activitystream/node.rs +++ b/src/activitystream/node.rs @@ -110,8 +110,15 @@ impl Node{ } } - pub fn object(x: serde_json::Value) -> Self { - Node::Object(Box::new(x)) + pub fn object(x: impl super::Base) -> Self { + Node::Object(Box::new(x.underlying_json_object())) + } + + pub fn maybe_object(x: Option) -> Self { + match x { + Some(x) => Node::Object(Box::new(x.underlying_json_object())), + None => Node::Empty, + } } pub fn array(x: Vec) -> Self {