forked from alemi/upub
fix: actor type from json Value
This commit is contained in:
parent
ef54867369
commit
410b077fea
1 changed files with 9 additions and 2 deletions
|
@ -1,4 +1,6 @@
|
||||||
use crate::strenum;
|
use crate::{activitystream::{Base, BaseType}, strenum};
|
||||||
|
|
||||||
|
use super::ObjectType;
|
||||||
|
|
||||||
strenum! {
|
strenum! {
|
||||||
pub enum ActorType {
|
pub enum ActorType {
|
||||||
|
@ -20,7 +22,12 @@ pub trait Actor : super::Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Actor for serde_json::Value {
|
impl Actor for serde_json::Value {
|
||||||
|
fn actor_type(&self) -> Option<ActorType> {
|
||||||
|
match self.base_type()? {
|
||||||
|
BaseType::Object(ObjectType::Actor(x)) => Some(x),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Profile for serde_json::Value {
|
impl Profile for serde_json::Value {
|
||||||
|
|
Loading…
Reference in a new issue