Don't implement activitypub's Object for Source

This commit is contained in:
Kitaiti Makoto 2022-05-03 01:17:27 +09:00
parent 6bbadc78b0
commit ccd3c8a3f2

View File

@ -1,11 +1,11 @@
use activitypub::{Link, Object}; use activitypub::Link;
use activitystreams::{ use activitystreams::{
actor::{ApActor, Group, Person}, actor::{ApActor, Group, Person},
base::{AnyBase, Base, Extends}, base::{AnyBase, Base, Extends},
iri_string::types::IriString, iri_string::types::IriString,
kind, kind,
markers::{self, Activity}, markers::{self, Activity},
object::{ApObject, Article, Object as Object07}, object::{ApObject, Article, Object},
primitives::{AnyString, OneOrMany}, primitives::{AnyString, OneOrMany},
unparsed::UnparsedMutExt, unparsed::UnparsedMutExt,
}; };
@ -287,7 +287,7 @@ pub struct Hashtag {
pub name: Option<AnyString>, pub name: Option<AnyString>,
#[serde(flatten)] #[serde(flatten)]
inner: Object07<HashtagType>, inner: Object<HashtagType>,
} }
impl Hashtag { impl Hashtag {
@ -295,18 +295,18 @@ impl Hashtag {
Self { Self {
href: None, href: None,
name: None, name: None,
inner: Object07::new(), inner: Object::new(),
} }
} }
pub fn extending(mut inner: Object07<HashtagType>) -> Result<Self, serde_json::Error> { pub fn extending(mut inner: Object<HashtagType>) -> Result<Self, serde_json::Error> {
let href = inner.remove("href")?; let href = inner.remove("href")?;
let name = inner.remove("name")?; let name = inner.remove("name")?;
Ok(Self { href, name, inner }) Ok(Self { href, name, inner })
} }
pub fn retracting(self) -> Result<Object07<HashtagType>, serde_json::Error> { pub fn retracting(self) -> Result<Object<HashtagType>, serde_json::Error> {
let Self { let Self {
href, href,
name, name,
@ -389,7 +389,7 @@ impl Extends<HashtagType> for Hashtag {
type Error = serde_json::Error; type Error = serde_json::Error;
fn extends(base: Base<HashtagType>) -> Result<Self, Self::Error> { fn extends(base: Base<HashtagType>) -> Result<Self, Self::Error> {
let inner = Object07::extends(base)?; let inner = Object::extends(base)?;
Self::extending(inner) Self::extending(inner)
} }
@ -411,8 +411,6 @@ pub struct Source {
pub content: String, pub content: String,
} }
impl Object for Source {}
impl<U> UnparsedExtension<U> for Source impl<U> UnparsedExtension<U> for Source
where where
U: UnparsedMutExt, U: UnparsedMutExt,