From 410b077feaa7f45bf964ab8740f5e4389f34d640 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 19 Mar 2024 07:38:48 +0100 Subject: [PATCH] fix: actor type from json Value --- src/activitystream/object/actor.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/activitystream/object/actor.rs b/src/activitystream/object/actor.rs index b39dede0..a89ea640 100644 --- a/src/activitystream/object/actor.rs +++ b/src/activitystream/object/actor.rs @@ -1,4 +1,6 @@ -use crate::strenum; +use crate::{activitystream::{Base, BaseType}, strenum}; + +use super::ObjectType; strenum! { pub enum ActorType { @@ -20,7 +22,12 @@ pub trait Actor : super::Object { } impl Actor for serde_json::Value { - + fn actor_type(&self) -> Option { + match self.base_type()? { + BaseType::Object(ObjectType::Actor(x)) => Some(x), + _ => None, + } + } } impl Profile for serde_json::Value {