2020-05-14 03:54:50 +00:00
|
|
|
use crate::{
|
2020-05-15 22:01:29 +00:00
|
|
|
base::{AnyBase, AsBase, Base, Extends},
|
|
|
|
markers,
|
|
|
|
object::{ApObject, AsObject, Object},
|
|
|
|
primitives::OneOrMany,
|
|
|
|
unparsed::{Unparsed, UnparsedMut, UnparsedMutExt},
|
2020-05-14 03:54:50 +00:00
|
|
|
};
|
|
|
|
use std::convert::TryFrom;
|
2020-05-14 16:23:38 +00:00
|
|
|
use typed_builder::TypedBuilder;
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
pub mod kind {
|
|
|
|
pub use activitystreams::activity::kind::*;
|
|
|
|
}
|
|
|
|
|
|
|
|
use self::kind::*;
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
pub trait AsActivity<Kind>: markers::Activity {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_ref(&self) -> &Activity<Kind>;
|
|
|
|
fn activity_mut(&mut self) -> &mut Activity<Kind>;
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
pub trait ActorAndObjectRef: markers::Activity {
|
|
|
|
fn actor_field_ref(&self) -> &OneOrMany<AnyBase>;
|
|
|
|
fn object_field_ref(&self) -> &OneOrMany<AnyBase>;
|
|
|
|
fn actor_field_mut(&mut self) -> &mut OneOrMany<AnyBase>;
|
|
|
|
fn object_field_mut(&mut self) -> &mut OneOrMany<AnyBase>;
|
2020-05-15 03:18:34 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
pub trait TargetRef: markers::Activity {
|
|
|
|
fn target_field_ref(&self) -> &OneOrMany<AnyBase>;
|
|
|
|
fn target_field_mut(&mut self) -> &mut OneOrMany<AnyBase>;
|
2020-05-15 03:18:34 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
pub trait OriginRef: markers::Activity {
|
|
|
|
fn origin_field_ref(&self) -> &OneOrMany<AnyBase>;
|
|
|
|
fn origin_field_mut(&mut self) -> &mut OneOrMany<AnyBase>;
|
2020-05-15 03:18:34 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
pub trait OptTargetRef: markers::Activity {
|
|
|
|
fn target_field_ref(&self) -> &Option<OneOrMany<AnyBase>>;
|
|
|
|
fn target_field_mut(&mut self) -> &mut Option<OneOrMany<AnyBase>>;
|
2020-05-15 03:18:34 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
pub trait OptOriginRef: markers::Activity {
|
|
|
|
fn origin_field_ref(&self) -> &Option<OneOrMany<AnyBase>>;
|
|
|
|
fn origin_field_mut(&mut self) -> &mut Option<OneOrMany<AnyBase>>;
|
2020-05-15 03:18:34 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
pub trait AsQuestion: markers::Activity {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn question_ref(&self) -> &Question;
|
|
|
|
fn question_mut(&mut self) -> &mut Question;
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
pub trait ActivityExt<Kind>: AsActivity<Kind> {
|
|
|
|
fn result<'a>(&'a self) -> Option<&'a OneOrMany<AnyBase>>
|
2020-05-15 03:18:34 +00:00
|
|
|
where
|
|
|
|
Kind: 'a,
|
|
|
|
{
|
|
|
|
self.activity_ref().result.as_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_result<T>(&mut self, result: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
self.activity_mut().result = Some(result.into().into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_many_results<I, T>(&mut self, items: I) -> &mut Self
|
|
|
|
where
|
|
|
|
I: IntoIterator<Item = T>,
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v: Vec<_> = items.into_iter().map(Into::into).collect();
|
|
|
|
self.activity_mut().result = Some(v.into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_result<T>(&mut self, result: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let c = match self.activity_mut().result.take() {
|
|
|
|
Some(mut c) => {
|
|
|
|
c.add(result.into());
|
|
|
|
c
|
|
|
|
}
|
|
|
|
None => vec![result.into()].into(),
|
|
|
|
};
|
|
|
|
self.activity_mut().result = Some(c);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn take_result(&mut self) -> Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.activity_mut().result.take()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn delete_result(&mut self) -> &mut Self {
|
|
|
|
self.activity_mut().result = None;
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn instrument<'a>(&'a self) -> Option<&'a OneOrMany<AnyBase>>
|
|
|
|
where
|
|
|
|
Kind: 'a,
|
|
|
|
{
|
|
|
|
self.activity_ref().instrument.as_ref()
|
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
fn set_instrument<T>(&mut self, instrument: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
self.activity_mut().instrument = Some(instrument.into().into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_many_instruments<I, T>(&mut self, items: I) -> &mut Self
|
|
|
|
where
|
|
|
|
I: IntoIterator<Item = T>,
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v: Vec<_> = items.into_iter().map(Into::into).collect();
|
|
|
|
self.activity_mut().instrument = Some(v.into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_instrument<T>(&mut self, instrument: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let c = match self.activity_mut().instrument.take() {
|
|
|
|
Some(mut c) => {
|
|
|
|
c.add(instrument.into());
|
|
|
|
c
|
|
|
|
}
|
|
|
|
None => vec![instrument.into()].into(),
|
|
|
|
};
|
|
|
|
self.activity_mut().instrument = Some(c);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn take_instrument(&mut self) -> Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.activity_mut().instrument.take()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn delete_instrument(&mut self) -> &mut Self {
|
|
|
|
self.activity_mut().instrument = None;
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait ActorAndObjectRefExt: ActorAndObjectRef {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor(&self) -> &OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.actor_field_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_actor<T>(&mut self, actor: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
*self.actor_field_mut() = actor.into().into();
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_many_actors<I, T>(&mut self, items: I) -> &mut Self
|
|
|
|
where
|
|
|
|
I: IntoIterator<Item = T>,
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v: Vec<_> = items.into_iter().map(Into::into).collect();
|
|
|
|
*self.actor_field_mut() = v.into();
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_actor<T>(&mut self, actor: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
self.actor_field_mut().add(actor.into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object(&self) -> &OneOrMany<AnyBase> {
|
|
|
|
self.object_field_ref()
|
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
fn set_object<T>(&mut self, object: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
*self.object_field_mut() = object.into().into();
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_many_objects<I, T>(&mut self, items: I) -> &mut Self
|
|
|
|
where
|
|
|
|
I: IntoIterator<Item = T>,
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v: Vec<_> = items.into_iter().map(Into::into).collect();
|
|
|
|
*self.object_field_mut() = v.into();
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_object<T>(&mut self, object: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
self.object_field_mut().add(object.into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait TargetRefExt: TargetRef {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target(&self) -> &OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.target_field_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_target<T>(&mut self, target: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
*self.target_field_mut() = target.into().into();
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_many_targets<I, T>(&mut self, items: I) -> &mut Self
|
|
|
|
where
|
|
|
|
I: IntoIterator<Item = T>,
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v: Vec<_> = items.into_iter().map(Into::into).collect();
|
|
|
|
*self.target_field_mut() = v.into();
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_target<T>(&mut self, target: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
self.target_field_mut().add(target.into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait OriginRefExt: OriginRef {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin(&self) -> &OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.origin_field_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_origin<T>(&mut self, origin: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
*self.origin_field_mut() = origin.into().into();
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_many_origins<I, T>(&mut self, items: I) -> &mut Self
|
|
|
|
where
|
|
|
|
I: IntoIterator<Item = T>,
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v: Vec<_> = items.into_iter().map(Into::into).collect();
|
|
|
|
*self.origin_field_mut() = v.into();
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_origin<T>(&mut self, origin: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
self.origin_field_mut().add(origin.into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait OptTargetRefExt: OptTargetRef {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target(&self) -> Option<&OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.target_field_ref().as_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_target<T>(&mut self, target: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
*self.target_field_mut() = Some(target.into().into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_many_targets<I, T>(&mut self, items: I) -> &mut Self
|
|
|
|
where
|
|
|
|
I: IntoIterator<Item = T>,
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v: Vec<_> = items.into_iter().map(Into::into).collect();
|
|
|
|
*self.target_field_mut() = Some(v.into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_target<T>(&mut self, target: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let c = match self.target_field_mut().take() {
|
|
|
|
Some(mut c) => {
|
|
|
|
c.add(target.into());
|
|
|
|
c
|
|
|
|
}
|
|
|
|
None => vec![target.into()].into(),
|
|
|
|
};
|
|
|
|
*self.target_field_mut() = Some(c);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn take_target(&mut self) -> Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.target_field_mut().take()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn delete_target(&mut self) -> &mut Self {
|
|
|
|
*self.target_field_mut() = None;
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait OptOriginRefExt: OptOriginRef {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin(&self) -> Option<&OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.origin_field_ref().as_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_origin<T>(&mut self, origin: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
*self.origin_field_mut() = Some(origin.into().into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_many_origins<I, T>(&mut self, items: I) -> &mut Self
|
|
|
|
where
|
|
|
|
I: IntoIterator<Item = T>,
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v: Vec<_> = items.into_iter().map(Into::into).collect();
|
|
|
|
*self.origin_field_mut() = Some(v.into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_origin<T>(&mut self, origin: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let c = match self.origin_field_mut().take() {
|
|
|
|
Some(mut c) => {
|
|
|
|
c.add(origin.into());
|
|
|
|
c
|
|
|
|
}
|
|
|
|
None => vec![origin.into()].into(),
|
|
|
|
};
|
|
|
|
*self.origin_field_mut() = Some(c);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn take_origin(&mut self) -> Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.origin_field_mut().take()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn delete_origin(&mut self) -> &mut Self {
|
|
|
|
*self.origin_field_mut() = None;
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
pub trait QuestionExt: AsQuestion {
|
|
|
|
fn one_of(&self) -> Option<&OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.question_ref().one_of.as_ref()
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn any_of(&self) -> Option<&OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.question_ref().any_of.as_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_one_of<T>(&mut self, one_of: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
self.question_mut().one_of = Some(one_of.into().into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_many_one_ofs<I, T>(&mut self, items: I) -> &mut Self
|
|
|
|
where
|
|
|
|
I: IntoIterator<Item = T>,
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v: Vec<_> = items.into_iter().map(Into::into).collect();
|
|
|
|
self.question_mut().one_of = Some(v.into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_one_of<T>(&mut self, one_of: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v = match self.question_mut().one_of.take() {
|
|
|
|
Some(mut v) => {
|
|
|
|
v.add(one_of.into());
|
|
|
|
v
|
|
|
|
}
|
|
|
|
None => vec![one_of.into()].into(),
|
|
|
|
};
|
|
|
|
self.question_mut().one_of = Some(v);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn take_one_of(&mut self) -> Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.question_mut().one_of.take()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn delete_one_of(&mut self) -> &mut Self {
|
|
|
|
self.question_mut().one_of = None;
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_any_of<T>(&mut self, any_of: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
self.question_mut().any_of = Some(any_of.into().into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_many_any_ofs<I, T>(&mut self, items: I) -> &mut Self
|
|
|
|
where
|
|
|
|
I: IntoIterator<Item = T>,
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v: Vec<_> = items.into_iter().map(Into::into).collect();
|
|
|
|
self.question_mut().any_of = Some(v.into());
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_any_of<T>(&mut self, any_of: T) -> &mut Self
|
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
T: Into<AnyBase>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
let v = match self.question_mut().any_of.take() {
|
|
|
|
Some(mut v) => {
|
|
|
|
v.add(any_of.into());
|
|
|
|
v
|
|
|
|
}
|
|
|
|
None => vec![any_of.into()].into(),
|
|
|
|
};
|
|
|
|
self.question_mut().any_of = Some(v);
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn take_any_of(&mut self) -> Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.question_mut().any_of.take()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn delete_any_of(&mut self) -> &mut Self {
|
|
|
|
self.question_mut().any_of = None;
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 03:54:50 +00:00
|
|
|
pub type Accept = ActorAndObject<AcceptType>;
|
|
|
|
pub type Add = ActorAndObject<AddType>;
|
|
|
|
pub type Block = ActorAndObject<BlockType>;
|
|
|
|
pub type Create = ActorAndObject<CreateType>;
|
|
|
|
pub type Dislike = ActorAndObject<DislikeType>;
|
|
|
|
pub type Flag = ActorAndObject<FlagType>;
|
|
|
|
pub type Follow = ActorAndObject<FollowType>;
|
|
|
|
pub type Ignore = ActorAndObject<IgnoreType>;
|
|
|
|
pub type Join = ActorAndObject<JoinType>;
|
|
|
|
pub type Leave = ActorAndObject<LeaveType>;
|
|
|
|
pub type Like = ActorAndObject<LikeType>;
|
|
|
|
pub type Listen = ActorAndObject<ListenType>;
|
|
|
|
pub type Read = ActorAndObject<ReadType>;
|
|
|
|
pub type Reject = ActorAndObject<RejectType>;
|
|
|
|
pub type TentativeAccept = ActorAndObject<TentativeAcceptType>;
|
|
|
|
pub type TentativeReject = ActorAndObject<TentativeRejectType>;
|
|
|
|
pub type Undo = ActorAndObject<UndoType>;
|
|
|
|
pub type Update = ActorAndObject<UpdateType>;
|
|
|
|
pub type View = ActorAndObject<ViewType>;
|
|
|
|
|
|
|
|
pub type Announce = ActorAndObjectOptTarget<AnnounceType>;
|
|
|
|
pub type Offer = ActorAndObjectOptTarget<OfferType>;
|
|
|
|
|
|
|
|
pub type Move = ActorAndObjectOptOriginAndTarget<MoveType>;
|
|
|
|
pub type Remove = ActorAndObjectOptOriginAndTarget<RemoveType>;
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
2020-05-14 03:54:50 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(doc)]
|
2020-05-14 03:54:50 +00:00
|
|
|
pub struct Activity<Kind> {
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(default, setter(strip_option, into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub result: Option<OneOrMany<AnyBase>>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(default, setter(strip_option, into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub instrument: Option<OneOrMany<AnyBase>>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub inner: Object<Kind>,
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
2020-05-14 03:54:50 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(doc)]
|
2020-05-14 03:54:50 +00:00
|
|
|
pub struct ActorAndObject<Kind> {
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub actor: OneOrMany<AnyBase>,
|
2020-05-14 16:23:38 +00:00
|
|
|
|
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub object: OneOrMany<AnyBase>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub inner: Activity<Kind>,
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
2020-05-14 03:54:50 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(doc)]
|
2020-05-14 03:54:50 +00:00
|
|
|
pub struct Arrive {
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub actor: OneOrMany<AnyBase>,
|
2020-05-14 16:23:38 +00:00
|
|
|
|
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub origin: OneOrMany<AnyBase>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub inner: Activity<ArriveType>,
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
2020-05-14 03:54:50 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(doc)]
|
2020-05-14 03:54:50 +00:00
|
|
|
pub struct Invite {
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub actor: OneOrMany<AnyBase>,
|
2020-05-14 16:23:38 +00:00
|
|
|
|
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub object: OneOrMany<AnyBase>,
|
2020-05-14 16:23:38 +00:00
|
|
|
|
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub target: OneOrMany<AnyBase>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub inner: Activity<InviteType>,
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
2020-05-14 03:54:50 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(doc)]
|
2020-05-14 03:54:50 +00:00
|
|
|
pub struct Delete {
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub actor: OneOrMany<AnyBase>,
|
2020-05-14 16:23:38 +00:00
|
|
|
|
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub object: OneOrMany<AnyBase>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(default, setter(strip_option, into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub origin: Option<OneOrMany<AnyBase>>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub inner: Activity<DeleteType>,
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
2020-05-14 03:54:50 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(doc)]
|
2020-05-14 03:54:50 +00:00
|
|
|
pub struct ActorAndObjectOptOriginAndTarget<Kind> {
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub actor: OneOrMany<AnyBase>,
|
2020-05-14 16:23:38 +00:00
|
|
|
|
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub object: OneOrMany<AnyBase>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(default, setter(strip_option, into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub origin: Option<OneOrMany<AnyBase>>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(default, setter(strip_option, into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub target: Option<OneOrMany<AnyBase>>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub inner: Activity<Kind>,
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
2020-05-14 03:54:50 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(doc)]
|
2020-05-14 03:54:50 +00:00
|
|
|
pub struct ActorAndObjectOptTarget<Kind> {
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub actor: OneOrMany<AnyBase>,
|
2020-05-14 16:23:38 +00:00
|
|
|
|
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub object: OneOrMany<AnyBase>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(default, setter(strip_option, into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub target: Option<OneOrMany<AnyBase>>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub inner: Activity<Kind>,
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
2020-05-14 03:54:50 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(doc)]
|
2020-05-14 03:54:50 +00:00
|
|
|
pub struct Travel {
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(setter(into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub actor: OneOrMany<AnyBase>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(default, setter(strip_option, into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub origin: Option<OneOrMany<AnyBase>>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(default, setter(strip_option, into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub target: Option<OneOrMany<AnyBase>>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub inner: Activity<TravelType>,
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, TypedBuilder)]
|
2020-05-14 03:54:50 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(doc)]
|
2020-05-14 03:54:50 +00:00
|
|
|
pub struct Question {
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(default, setter(strip_option, into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub one_of: Option<OneOrMany<AnyBase>>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
2020-05-14 16:23:38 +00:00
|
|
|
#[builder(default, setter(strip_option, into))]
|
2020-05-15 22:01:29 +00:00
|
|
|
pub any_of: Option<OneOrMany<AnyBase>>,
|
2020-05-14 03:54:50 +00:00
|
|
|
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub inner: Activity<QuestionType>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> Activity<Kind> {
|
|
|
|
fn extending(mut inner: Object<Kind>) -> Result<Self, serde_json::Error> {
|
|
|
|
let result = inner.remove("result")?;
|
|
|
|
let instrument = inner.remove("instrument")?;
|
|
|
|
|
|
|
|
Ok(Activity {
|
|
|
|
result,
|
|
|
|
instrument,
|
|
|
|
inner,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn retracting(self) -> Result<Object<Kind>, serde_json::Error> {
|
|
|
|
let Activity {
|
|
|
|
result,
|
|
|
|
instrument,
|
|
|
|
mut inner,
|
|
|
|
} = self;
|
|
|
|
|
|
|
|
inner
|
|
|
|
.insert("result", result)?
|
|
|
|
.insert("instrument", instrument)?;
|
|
|
|
|
|
|
|
Ok(inner)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> ActorAndObject<Kind> {
|
|
|
|
fn extending(object: Object<Kind>) -> Result<Self, serde_json::Error> {
|
|
|
|
let mut inner = Activity::extending(object)?;
|
|
|
|
|
|
|
|
let actor = inner.remove("actor")?;
|
|
|
|
let object = inner.remove("object")?;
|
|
|
|
|
|
|
|
Ok(ActorAndObject {
|
|
|
|
actor,
|
|
|
|
object,
|
|
|
|
inner,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn retracting(self) -> Result<Object<Kind>, serde_json::Error> {
|
|
|
|
let ActorAndObject {
|
|
|
|
actor,
|
|
|
|
object,
|
|
|
|
mut inner,
|
|
|
|
} = self;
|
|
|
|
|
|
|
|
inner.insert("actor", actor)?.insert("object", object)?;
|
|
|
|
|
|
|
|
inner.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Arrive {
|
|
|
|
fn extending(object: Object<ArriveType>) -> Result<Self, serde_json::Error> {
|
|
|
|
let mut inner = Activity::extending(object)?;
|
|
|
|
|
|
|
|
let actor = inner.remove("actor")?;
|
|
|
|
let origin = inner.remove("origin")?;
|
|
|
|
|
|
|
|
Ok(Arrive {
|
|
|
|
actor,
|
|
|
|
origin,
|
|
|
|
inner,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn retracting(self) -> Result<Object<ArriveType>, serde_json::Error> {
|
|
|
|
let Arrive {
|
|
|
|
actor,
|
|
|
|
origin,
|
|
|
|
mut inner,
|
|
|
|
} = self;
|
|
|
|
|
|
|
|
inner.insert("actor", actor)?.insert("origin", origin)?;
|
|
|
|
|
|
|
|
inner.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Invite {
|
|
|
|
fn extending(object: Object<InviteType>) -> Result<Self, serde_json::Error> {
|
|
|
|
let mut inner = Activity::extending(object)?;
|
|
|
|
|
|
|
|
let actor = inner.remove("actor")?;
|
|
|
|
let object = inner.remove("object")?;
|
|
|
|
let target = inner.remove("target")?;
|
|
|
|
|
|
|
|
Ok(Invite {
|
|
|
|
actor,
|
|
|
|
object,
|
|
|
|
target,
|
|
|
|
inner,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn retracting(self) -> Result<Object<InviteType>, serde_json::Error> {
|
|
|
|
let Invite {
|
|
|
|
actor,
|
|
|
|
object,
|
|
|
|
target,
|
|
|
|
mut inner,
|
|
|
|
} = self;
|
|
|
|
|
|
|
|
inner
|
|
|
|
.insert("actor", actor)?
|
|
|
|
.insert("object", object)?
|
|
|
|
.insert("target", target)?;
|
|
|
|
|
|
|
|
inner.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Delete {
|
|
|
|
fn extending(object: Object<DeleteType>) -> Result<Self, serde_json::Error> {
|
|
|
|
let mut inner = Activity::extending(object)?;
|
|
|
|
|
|
|
|
let actor = inner.remove("actor")?;
|
|
|
|
let object = inner.remove("object")?;
|
|
|
|
let origin = inner.remove("origin")?;
|
|
|
|
|
|
|
|
Ok(Delete {
|
|
|
|
actor,
|
|
|
|
object,
|
|
|
|
origin,
|
|
|
|
inner,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn retracting(self) -> Result<Object<DeleteType>, serde_json::Error> {
|
|
|
|
let Delete {
|
|
|
|
actor,
|
|
|
|
object,
|
|
|
|
origin,
|
|
|
|
mut inner,
|
|
|
|
} = self;
|
|
|
|
|
|
|
|
inner
|
|
|
|
.insert("actor", actor)?
|
|
|
|
.insert("object", object)?
|
|
|
|
.insert("origin", origin)?;
|
|
|
|
|
|
|
|
inner.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> ActorAndObjectOptOriginAndTarget<Kind> {
|
|
|
|
fn extending(object: Object<Kind>) -> Result<Self, serde_json::Error> {
|
|
|
|
let mut inner = Activity::extending(object)?;
|
|
|
|
|
|
|
|
let actor = inner.remove("actor")?;
|
|
|
|
let object = inner.remove("object")?;
|
|
|
|
let origin = inner.remove("origin")?;
|
|
|
|
let target = inner.remove("target")?;
|
|
|
|
|
|
|
|
Ok(ActorAndObjectOptOriginAndTarget {
|
|
|
|
actor,
|
|
|
|
object,
|
|
|
|
origin,
|
|
|
|
target,
|
|
|
|
inner,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn retracting(self) -> Result<Object<Kind>, serde_json::Error> {
|
|
|
|
let ActorAndObjectOptOriginAndTarget {
|
|
|
|
actor,
|
|
|
|
object,
|
|
|
|
origin,
|
|
|
|
target,
|
|
|
|
mut inner,
|
|
|
|
} = self;
|
|
|
|
|
|
|
|
inner
|
|
|
|
.insert("actor", actor)?
|
|
|
|
.insert("object", object)?
|
|
|
|
.insert("origin", origin)?
|
|
|
|
.insert("target", target)?;
|
|
|
|
|
|
|
|
inner.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> ActorAndObjectOptTarget<Kind> {
|
|
|
|
fn extending(object: Object<Kind>) -> Result<Self, serde_json::Error> {
|
|
|
|
let mut inner = Activity::extending(object)?;
|
|
|
|
|
|
|
|
let actor = inner.remove("actor")?;
|
|
|
|
let object = inner.remove("object")?;
|
|
|
|
let target = inner.remove("target")?;
|
|
|
|
|
|
|
|
Ok(ActorAndObjectOptTarget {
|
|
|
|
actor,
|
|
|
|
object,
|
|
|
|
target,
|
|
|
|
inner,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn retracting(self) -> Result<Object<Kind>, serde_json::Error> {
|
|
|
|
let ActorAndObjectOptTarget {
|
|
|
|
actor,
|
|
|
|
object,
|
|
|
|
target,
|
|
|
|
mut inner,
|
|
|
|
} = self;
|
|
|
|
|
|
|
|
inner
|
|
|
|
.insert("actor", actor)?
|
|
|
|
.insert("object", object)?
|
|
|
|
.insert("target", target)?;
|
|
|
|
|
|
|
|
inner.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Travel {
|
|
|
|
fn extending(object: Object<TravelType>) -> Result<Self, serde_json::Error> {
|
|
|
|
let mut inner = Activity::extending(object)?;
|
|
|
|
|
|
|
|
let actor = inner.remove("actor")?;
|
|
|
|
let origin = inner.remove("origin")?;
|
|
|
|
let target = inner.remove("target")?;
|
|
|
|
|
|
|
|
Ok(Travel {
|
|
|
|
actor,
|
|
|
|
origin,
|
|
|
|
target,
|
|
|
|
inner,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn retracting(self) -> Result<Object<TravelType>, serde_json::Error> {
|
|
|
|
let Travel {
|
|
|
|
actor,
|
|
|
|
origin,
|
|
|
|
target,
|
|
|
|
mut inner,
|
|
|
|
} = self;
|
|
|
|
|
|
|
|
inner
|
|
|
|
.insert("actor", actor)?
|
|
|
|
.insert("origin", origin)?
|
|
|
|
.insert("target", target)?;
|
|
|
|
|
|
|
|
inner.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Question {
|
|
|
|
fn extending(object: Object<QuestionType>) -> Result<Self, serde_json::Error> {
|
|
|
|
let mut inner = Activity::extending(object)?;
|
|
|
|
|
|
|
|
let one_of = inner.remove("oneOf")?;
|
|
|
|
let any_of = inner.remove("anyOf")?;
|
|
|
|
|
|
|
|
Ok(Question {
|
|
|
|
one_of,
|
|
|
|
any_of,
|
|
|
|
inner,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn retracting(self) -> Result<Object<QuestionType>, serde_json::Error> {
|
|
|
|
let Question {
|
|
|
|
one_of,
|
|
|
|
any_of,
|
|
|
|
mut inner,
|
|
|
|
} = self;
|
|
|
|
|
|
|
|
inner.insert("oneOf", one_of)?.insert("anyOf", any_of)?;
|
|
|
|
|
|
|
|
inner.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> markers::Base for Activity<Kind> {}
|
|
|
|
impl<Kind> markers::Object for Activity<Kind> {}
|
|
|
|
impl<Kind> markers::Activity for Activity<Kind> {}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> markers::Base for ActorAndObject<Kind> {}
|
|
|
|
impl<Kind> markers::Object for ActorAndObject<Kind> {}
|
|
|
|
impl<Kind> markers::Activity for ActorAndObject<Kind> {}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> markers::Base for ActorAndObjectOptTarget<Kind> {}
|
|
|
|
impl<Kind> markers::Object for ActorAndObjectOptTarget<Kind> {}
|
|
|
|
impl<Kind> markers::Activity for ActorAndObjectOptTarget<Kind> {}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> markers::Base for ActorAndObjectOptOriginAndTarget<Kind> {}
|
|
|
|
impl<Kind> markers::Object for ActorAndObjectOptOriginAndTarget<Kind> {}
|
|
|
|
impl<Kind> markers::Activity for ActorAndObjectOptOriginAndTarget<Kind> {}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl markers::Base for Arrive {}
|
|
|
|
impl markers::Object for Arrive {}
|
|
|
|
impl markers::Activity for Arrive {}
|
|
|
|
impl markers::IntransitiveActivity for Arrive {}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl markers::Base for Invite {}
|
|
|
|
impl markers::Object for Invite {}
|
|
|
|
impl markers::Activity for Invite {}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl markers::Base for Delete {}
|
|
|
|
impl markers::Object for Delete {}
|
|
|
|
impl markers::Activity for Delete {}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl markers::Base for Travel {}
|
|
|
|
impl markers::Object for Travel {}
|
|
|
|
impl markers::Activity for Travel {}
|
|
|
|
impl markers::IntransitiveActivity for Travel {}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl markers::Base for Question {}
|
|
|
|
impl markers::Object for Question {}
|
|
|
|
impl markers::Activity for Question {}
|
|
|
|
impl markers::IntransitiveActivity for Question {}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Inner> markers::Activity for ApObject<Inner> where Inner: markers::Activity {}
|
|
|
|
impl<Inner> markers::IntransitiveActivity for ApObject<Inner> where
|
|
|
|
Inner: markers::IntransitiveActivity
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> Extends<Kind> for Activity<Kind>
|
|
|
|
where
|
|
|
|
Kind: serde::de::DeserializeOwned + serde::ser::Serialize,
|
|
|
|
{
|
2020-05-14 03:54:50 +00:00
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn extends(base: Base<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
let inner = Object::extends(base)?;
|
|
|
|
Self::extending(inner)
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn retracts(self) -> Result<Base<Kind>, Self::Error> {
|
|
|
|
let inner = self.retracting()?;
|
|
|
|
inner.retracts()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> TryFrom<Object<Kind>> for Activity<Kind> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(object: Object<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
Self::extending(object)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
impl<Kind> TryFrom<Activity<Kind>> for Object<Kind> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(activity: Activity<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
activity.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> Extends<Kind> for ActorAndObject<Kind>
|
|
|
|
where
|
|
|
|
Kind: serde::de::DeserializeOwned + serde::ser::Serialize,
|
|
|
|
{
|
2020-05-14 03:54:50 +00:00
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn extends(base: Base<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
let inner = Object::extends(base)?;
|
|
|
|
Self::extending(inner)
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn retracts(self) -> Result<Base<Kind>, Self::Error> {
|
|
|
|
let inner = self.retracting()?;
|
|
|
|
inner.retracts()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> TryFrom<Object<Kind>> for ActorAndObject<Kind> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(object: Object<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
Self::extending(object)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
impl<Kind> TryFrom<ActorAndObject<Kind>> for Object<Kind> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(activity: ActorAndObject<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
activity.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl Extends<ArriveType> for Arrive {
|
2020-05-14 03:54:50 +00:00
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn extends(base: Base<ArriveType>) -> Result<Self, Self::Error> {
|
|
|
|
let inner = Object::extends(base)?;
|
|
|
|
Self::extending(inner)
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn retracts(self) -> Result<Base<ArriveType>, Self::Error> {
|
|
|
|
let inner = self.retracting()?;
|
|
|
|
inner.retracts()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl TryFrom<Object<ArriveType>> for Arrive {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(object: Object<ArriveType>) -> Result<Self, Self::Error> {
|
|
|
|
Self::extending(object)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
impl TryFrom<Arrive> for Object<ArriveType> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(arrive: Arrive) -> Result<Self, Self::Error> {
|
|
|
|
arrive.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl Extends<InviteType> for Invite {
|
2020-05-14 03:54:50 +00:00
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn extends(base: Base<InviteType>) -> Result<Self, Self::Error> {
|
|
|
|
let inner = Object::extends(base)?;
|
|
|
|
Self::extending(inner)
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn retracts(self) -> Result<Base<InviteType>, Self::Error> {
|
|
|
|
let inner = self.retracting()?;
|
|
|
|
inner.retracts()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl TryFrom<Object<InviteType>> for Invite {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(object: Object<InviteType>) -> Result<Self, Self::Error> {
|
|
|
|
Self::extending(object)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
impl TryFrom<Invite> for Object<InviteType> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(invite: Invite) -> Result<Self, Self::Error> {
|
|
|
|
invite.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl Extends<DeleteType> for Delete {
|
2020-05-14 03:54:50 +00:00
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn extends(base: Base<DeleteType>) -> Result<Self, Self::Error> {
|
|
|
|
let inner = Object::extends(base)?;
|
|
|
|
Self::extending(inner)
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn retracts(self) -> Result<Base<DeleteType>, Self::Error> {
|
|
|
|
let inner = self.retracting()?;
|
|
|
|
inner.retracts()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl TryFrom<Object<DeleteType>> for Delete {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(object: Object<DeleteType>) -> Result<Self, Self::Error> {
|
|
|
|
Self::extending(object)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
impl TryFrom<Delete> for Object<DeleteType> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(delete: Delete) -> Result<Self, Self::Error> {
|
|
|
|
delete.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> Extends<Kind> for ActorAndObjectOptOriginAndTarget<Kind>
|
|
|
|
where
|
|
|
|
Kind: serde::de::DeserializeOwned + serde::ser::Serialize,
|
|
|
|
{
|
2020-05-14 03:54:50 +00:00
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn extends(base: Base<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
let inner = Object::extends(base)?;
|
|
|
|
Self::extending(inner)
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn retracts(self) -> Result<Base<Kind>, Self::Error> {
|
|
|
|
let inner = self.retracting()?;
|
|
|
|
inner.retracts()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> TryFrom<Object<Kind>> for ActorAndObjectOptOriginAndTarget<Kind> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(object: Object<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
Self::extending(object)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
impl<Kind> TryFrom<ActorAndObjectOptOriginAndTarget<Kind>> for Object<Kind> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(activity: ActorAndObjectOptOriginAndTarget<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
activity.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> Extends<Kind> for ActorAndObjectOptTarget<Kind>
|
|
|
|
where
|
|
|
|
Kind: serde::de::DeserializeOwned + serde::ser::Serialize,
|
|
|
|
{
|
2020-05-14 03:54:50 +00:00
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn extends(base: Base<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
let inner = Object::extends(base)?;
|
|
|
|
Self::extending(inner)
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn retracts(self) -> Result<Base<Kind>, Self::Error> {
|
|
|
|
let inner = self.retracting()?;
|
|
|
|
inner.retracts()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> TryFrom<Object<Kind>> for ActorAndObjectOptTarget<Kind> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(object: Object<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
Self::extending(object)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
impl<Kind> TryFrom<ActorAndObjectOptTarget<Kind>> for Object<Kind> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(activity: ActorAndObjectOptTarget<Kind>) -> Result<Self, Self::Error> {
|
|
|
|
activity.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl Extends<TravelType> for Travel {
|
2020-05-14 03:54:50 +00:00
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn extends(base: Base<TravelType>) -> Result<Self, Self::Error> {
|
|
|
|
let inner = Object::extends(base)?;
|
|
|
|
Self::extending(inner)
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn retracts(self) -> Result<Base<TravelType>, Self::Error> {
|
|
|
|
let inner = self.retracting()?;
|
|
|
|
inner.retracts()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl TryFrom<Object<TravelType>> for Travel {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(object: Object<TravelType>) -> Result<Self, Self::Error> {
|
|
|
|
Self::extending(object)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
impl TryFrom<Travel> for Object<TravelType> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(travel: Travel) -> Result<Self, Self::Error> {
|
|
|
|
travel.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl Extends<QuestionType> for Question {
|
2020-05-14 03:54:50 +00:00
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn extends(base: Base<QuestionType>) -> Result<Self, Self::Error> {
|
|
|
|
let inner = Object::extends(base)?;
|
|
|
|
Self::extending(inner)
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn retracts(self) -> Result<Base<QuestionType>, Self::Error> {
|
|
|
|
let inner = self.retracting()?;
|
|
|
|
inner.retracts()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl TryFrom<Object<QuestionType>> for Question {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(object: Object<QuestionType>) -> Result<Self, Self::Error> {
|
|
|
|
Self::extending(object)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-14 16:23:38 +00:00
|
|
|
impl TryFrom<Question> for Object<QuestionType> {
|
|
|
|
type Error = serde_json::Error;
|
|
|
|
|
|
|
|
fn try_from(question: Question) -> Result<Self, Self::Error> {
|
|
|
|
question.retracting()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
impl<Kind> UnparsedMut for Activity<Kind> {
|
2020-05-14 03:54:50 +00:00
|
|
|
fn unparsed_mut(&mut self) -> &mut Unparsed {
|
|
|
|
self.inner.unparsed_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
impl<Kind> UnparsedMut for ActorAndObject<Kind> {
|
|
|
|
fn unparsed_mut(&mut self) -> &mut Unparsed {
|
|
|
|
self.inner.unparsed_mut()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
2020-05-15 03:18:34 +00:00
|
|
|
}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
impl UnparsedMut for Arrive {
|
2020-05-14 03:54:50 +00:00
|
|
|
fn unparsed_mut(&mut self) -> &mut Unparsed {
|
|
|
|
self.inner.unparsed_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
impl UnparsedMut for Invite {
|
|
|
|
fn unparsed_mut(&mut self) -> &mut Unparsed {
|
|
|
|
self.inner.unparsed_mut()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
2020-05-15 03:18:34 +00:00
|
|
|
}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
impl UnparsedMut for Delete {
|
2020-05-14 03:54:50 +00:00
|
|
|
fn unparsed_mut(&mut self) -> &mut Unparsed {
|
|
|
|
self.inner.unparsed_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
impl<Kind> UnparsedMut for ActorAndObjectOptOriginAndTarget<Kind> {
|
|
|
|
fn unparsed_mut(&mut self) -> &mut Unparsed {
|
|
|
|
self.inner.unparsed_mut()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
2020-05-15 03:18:34 +00:00
|
|
|
}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
impl<Kind> UnparsedMut for ActorAndObjectOptTarget<Kind> {
|
2020-05-14 03:54:50 +00:00
|
|
|
fn unparsed_mut(&mut self) -> &mut Unparsed {
|
|
|
|
self.inner.unparsed_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
impl UnparsedMut for Travel {
|
|
|
|
fn unparsed_mut(&mut self) -> &mut Unparsed {
|
|
|
|
self.inner.unparsed_mut()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
2020-05-15 03:18:34 +00:00
|
|
|
}
|
2020-05-14 03:54:50 +00:00
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
impl UnparsedMut for Question {
|
2020-05-14 03:54:50 +00:00
|
|
|
fn unparsed_mut(&mut self) -> &mut Unparsed {
|
|
|
|
self.inner.unparsed_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> AsBase<Kind> for Activity<Kind> {
|
|
|
|
fn base_ref(&self) -> &Base<Kind> {
|
|
|
|
self.inner.base_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn base_mut(&mut self) -> &mut Base<Kind> {
|
|
|
|
self.inner.base_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> AsObject<Kind> for Activity<Kind> {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_ref(&self) -> &Object<Kind> {
|
|
|
|
&self.inner
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_mut(&mut self) -> &mut Object<Kind> {
|
|
|
|
&mut self.inner
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> AsActivity<Kind> for Activity<Kind> {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_ref(&self) -> &Activity<Kind> {
|
|
|
|
self
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_mut(&mut self) -> &mut Activity<Kind> {
|
|
|
|
self
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> AsBase<Kind> for ActorAndObject<Kind> {
|
|
|
|
fn base_ref(&self) -> &Base<Kind> {
|
|
|
|
self.inner.base_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn base_mut(&mut self) -> &mut Base<Kind> {
|
|
|
|
self.inner.base_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> AsObject<Kind> for ActorAndObject<Kind> {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_ref(&self) -> &Object<Kind> {
|
|
|
|
self.inner.object_ref()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_mut(&mut self) -> &mut Object<Kind> {
|
|
|
|
self.inner.object_mut()
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> AsActivity<Kind> for ActorAndObject<Kind> {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_ref(&self) -> &Activity<Kind> {
|
|
|
|
&self.inner
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_mut(&mut self) -> &mut Activity<Kind> {
|
|
|
|
&mut self.inner
|
2020-05-14 03:54:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
impl<Kind> ActorAndObjectRef for ActorAndObject<Kind> {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-14 03:54:50 +00:00
|
|
|
&self.actor
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-14 03:54:50 +00:00
|
|
|
&self.object
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.actor
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.object
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> AsBase<Kind> for ActorAndObjectOptTarget<Kind> {
|
|
|
|
fn base_ref(&self) -> &Base<Kind> {
|
|
|
|
self.inner.base_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn base_mut(&mut self) -> &mut Base<Kind> {
|
|
|
|
self.inner.base_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> AsObject<Kind> for ActorAndObjectOptTarget<Kind> {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_ref(&self) -> &Object<Kind> {
|
|
|
|
self.inner.object_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn object_mut(&mut self) -> &mut Object<Kind> {
|
|
|
|
self.inner.object_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> AsActivity<Kind> for ActorAndObjectOptTarget<Kind> {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_ref(&self) -> &Activity<Kind> {
|
|
|
|
&self.inner
|
|
|
|
}
|
|
|
|
|
|
|
|
fn activity_mut(&mut self) -> &mut Activity<Kind> {
|
|
|
|
&mut self.inner
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> ActorAndObjectRef for ActorAndObjectOptTarget<Kind> {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-14 03:54:50 +00:00
|
|
|
&self.actor
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-14 03:54:50 +00:00
|
|
|
&self.object
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.actor
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.object
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> OptTargetRef for ActorAndObjectOptTarget<Kind> {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target_field_ref(&self) -> &Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&self.target
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target_field_mut(&mut self) -> &mut Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.target
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> AsBase<Kind> for ActorAndObjectOptOriginAndTarget<Kind> {
|
|
|
|
fn base_ref(&self) -> &Base<Kind> {
|
|
|
|
self.inner.base_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn base_mut(&mut self) -> &mut Base<Kind> {
|
|
|
|
self.inner.base_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> AsObject<Kind> for ActorAndObjectOptOriginAndTarget<Kind> {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_ref(&self) -> &Object<Kind> {
|
|
|
|
self.inner.object_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn object_mut(&mut self) -> &mut Object<Kind> {
|
|
|
|
self.inner.object_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Kind> AsActivity<Kind> for ActorAndObjectOptOriginAndTarget<Kind> {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_ref(&self) -> &Activity<Kind> {
|
|
|
|
&self.inner
|
|
|
|
}
|
|
|
|
|
|
|
|
fn activity_mut(&mut self) -> &mut Activity<Kind> {
|
|
|
|
&mut self.inner
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> ActorAndObjectRef for ActorAndObjectOptOriginAndTarget<Kind> {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-14 03:54:50 +00:00
|
|
|
&self.actor
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-14 03:54:50 +00:00
|
|
|
&self.object
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.actor
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.object
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> OptTargetRef for ActorAndObjectOptOriginAndTarget<Kind> {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target_field_ref(&self) -> &Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&self.target
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target_field_mut(&mut self) -> &mut Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.target
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Kind> OptOriginRef for ActorAndObjectOptOriginAndTarget<Kind> {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin_field_ref(&self) -> &Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&self.origin
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin_field_mut(&mut self) -> &mut Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.origin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsBase<ArriveType> for Arrive {
|
|
|
|
fn base_ref(&self) -> &Base<ArriveType> {
|
|
|
|
self.inner.base_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn base_mut(&mut self) -> &mut Base<ArriveType> {
|
|
|
|
self.inner.base_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AsObject<ArriveType> for Arrive {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_ref(&self) -> &Object<ArriveType> {
|
|
|
|
self.inner.object_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn object_mut(&mut self) -> &mut Object<ArriveType> {
|
|
|
|
self.inner.object_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsActivity<ArriveType> for Arrive {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_ref(&self) -> &Activity<ArriveType> {
|
|
|
|
&self.inner
|
|
|
|
}
|
|
|
|
|
|
|
|
fn activity_mut(&mut self) -> &mut Activity<ArriveType> {
|
|
|
|
&mut self.inner
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl OriginRef for Arrive {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&self.origin
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.origin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsBase<InviteType> for Invite {
|
|
|
|
fn base_ref(&self) -> &Base<InviteType> {
|
|
|
|
self.inner.base_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn base_mut(&mut self) -> &mut Base<InviteType> {
|
|
|
|
self.inner.base_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AsObject<InviteType> for Invite {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_ref(&self) -> &Object<InviteType> {
|
|
|
|
self.inner.object_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn object_mut(&mut self) -> &mut Object<InviteType> {
|
|
|
|
self.inner.object_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsActivity<InviteType> for Invite {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_ref(&self) -> &Activity<InviteType> {
|
|
|
|
&self.inner
|
|
|
|
}
|
|
|
|
|
|
|
|
fn activity_mut(&mut self) -> &mut Activity<InviteType> {
|
|
|
|
&mut self.inner
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ActorAndObjectRef for Invite {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-14 03:54:50 +00:00
|
|
|
&self.actor
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-14 03:54:50 +00:00
|
|
|
&self.object
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.actor
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.object
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl TargetRef for Invite {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&self.target
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.target
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsBase<DeleteType> for Delete {
|
|
|
|
fn base_ref(&self) -> &Base<DeleteType> {
|
|
|
|
self.inner.base_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn base_mut(&mut self) -> &mut Base<DeleteType> {
|
|
|
|
self.inner.base_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AsObject<DeleteType> for Delete {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_ref(&self) -> &Object<DeleteType> {
|
|
|
|
self.inner.object_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn object_mut(&mut self) -> &mut Object<DeleteType> {
|
|
|
|
self.inner.object_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsActivity<DeleteType> for Delete {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_ref(&self) -> &Activity<DeleteType> {
|
|
|
|
&self.inner
|
|
|
|
}
|
|
|
|
|
|
|
|
fn activity_mut(&mut self) -> &mut Activity<DeleteType> {
|
|
|
|
&mut self.inner
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ActorAndObjectRef for Delete {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-14 03:54:50 +00:00
|
|
|
&self.actor
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-14 03:54:50 +00:00
|
|
|
&self.object
|
|
|
|
}
|
2020-05-15 03:18:34 +00:00
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.actor
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.object
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl OptOriginRef for Delete {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin_field_ref(&self) -> &Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&self.origin
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin_field_mut(&mut self) -> &mut Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.origin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsBase<TravelType> for Travel {
|
|
|
|
fn base_ref(&self) -> &Base<TravelType> {
|
|
|
|
self.inner.base_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn base_mut(&mut self) -> &mut Base<TravelType> {
|
|
|
|
self.inner.base_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AsObject<TravelType> for Travel {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_ref(&self) -> &Object<TravelType> {
|
|
|
|
self.inner.object_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn object_mut(&mut self) -> &mut Object<TravelType> {
|
|
|
|
self.inner.object_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsActivity<TravelType> for Travel {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_ref(&self) -> &Activity<TravelType> {
|
|
|
|
self.inner.activity_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn activity_mut(&mut self) -> &mut Activity<TravelType> {
|
|
|
|
self.inner.activity_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl OptTargetRef for Travel {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target_field_ref(&self) -> &Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&self.target
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target_field_mut(&mut self) -> &mut Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.target
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl OptOriginRef for Travel {
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin_field_ref(&self) -> &Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&self.origin
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin_field_mut(&mut self) -> &mut Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
&mut self.origin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsBase<QuestionType> for Question {
|
|
|
|
fn base_ref(&self) -> &Base<QuestionType> {
|
|
|
|
self.inner.base_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn base_mut(&mut self) -> &mut Base<QuestionType> {
|
|
|
|
self.inner.base_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AsObject<QuestionType> for Question {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn object_ref(&self) -> &Object<QuestionType> {
|
|
|
|
self.inner.object_ref()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn object_mut(&mut self) -> &mut Object<QuestionType> {
|
|
|
|
self.inner.object_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsActivity<QuestionType> for Question {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_ref(&self) -> &Activity<QuestionType> {
|
|
|
|
&self.inner
|
|
|
|
}
|
|
|
|
|
|
|
|
fn activity_mut(&mut self) -> &mut Activity<QuestionType> {
|
|
|
|
&mut self.inner
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl AsQuestion for Question {
|
2020-05-15 03:18:34 +00:00
|
|
|
fn question_ref(&self) -> &Question {
|
|
|
|
self
|
|
|
|
}
|
|
|
|
|
|
|
|
fn question_mut(&mut self) -> &mut Question {
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Inner, Kind> AsActivity<Kind> for ApObject<Inner>
|
2020-05-15 03:18:34 +00:00
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
Inner: AsActivity<Kind>,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
fn activity_ref(&self) -> &Activity<Kind> {
|
|
|
|
self.inner.activity_ref()
|
|
|
|
}
|
2020-05-15 22:01:29 +00:00
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
fn activity_mut(&mut self) -> &mut Activity<Kind> {
|
|
|
|
self.inner.activity_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Inner> ActorAndObjectRef for ApObject<Inner>
|
|
|
|
where
|
|
|
|
Inner: ActorAndObjectRef,
|
|
|
|
{
|
2020-05-15 22:01:29 +00:00
|
|
|
fn actor_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.actor_field_ref()
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.object_field_ref()
|
|
|
|
}
|
2020-05-15 22:01:29 +00:00
|
|
|
|
|
|
|
fn actor_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.actor_field_mut()
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
fn object_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.object_field_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Inner> TargetRef for ApObject<Inner>
|
|
|
|
where
|
|
|
|
Inner: TargetRef,
|
|
|
|
{
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.target_field_ref()
|
|
|
|
}
|
2020-05-15 22:01:29 +00:00
|
|
|
|
|
|
|
fn target_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.target_field_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Inner> OriginRef for ApObject<Inner>
|
|
|
|
where
|
|
|
|
Inner: OriginRef,
|
|
|
|
{
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin_field_ref(&self) -> &OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.origin_field_ref()
|
|
|
|
}
|
2020-05-15 22:01:29 +00:00
|
|
|
|
|
|
|
fn origin_field_mut(&mut self) -> &mut OneOrMany<AnyBase> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.origin_field_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Inner> OptTargetRef for ApObject<Inner>
|
|
|
|
where
|
|
|
|
Inner: OptTargetRef,
|
|
|
|
{
|
2020-05-15 22:01:29 +00:00
|
|
|
fn target_field_ref(&self) -> &Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.target_field_ref()
|
|
|
|
}
|
2020-05-15 22:01:29 +00:00
|
|
|
|
|
|
|
fn target_field_mut(&mut self) -> &mut Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.target_field_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<Inner> OptOriginRef for ApObject<Inner>
|
|
|
|
where
|
|
|
|
Inner: OptOriginRef,
|
|
|
|
{
|
2020-05-15 22:01:29 +00:00
|
|
|
fn origin_field_ref(&self) -> &Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.origin_field_ref()
|
|
|
|
}
|
2020-05-15 22:01:29 +00:00
|
|
|
|
|
|
|
fn origin_field_mut(&mut self) -> &mut Option<OneOrMany<AnyBase>> {
|
2020-05-15 03:18:34 +00:00
|
|
|
self.inner.origin_field_mut()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 22:01:29 +00:00
|
|
|
impl<Inner> AsQuestion for ApObject<Inner>
|
2020-05-15 03:18:34 +00:00
|
|
|
where
|
2020-05-15 22:01:29 +00:00
|
|
|
Inner: AsQuestion,
|
2020-05-15 03:18:34 +00:00
|
|
|
{
|
|
|
|
fn question_ref(&self) -> &Question {
|
|
|
|
self.inner.question_ref()
|
|
|
|
}
|
2020-05-15 22:01:29 +00:00
|
|
|
|
2020-05-15 03:18:34 +00:00
|
|
|
fn question_mut(&mut self) -> &mut Question {
|
|
|
|
self.inner.question_mut()
|
|
|
|
}
|
|
|
|
}
|
2020-05-15 22:01:29 +00:00
|
|
|
|
|
|
|
impl<T, Kind> ActivityExt<Kind> for T where T: AsActivity<Kind> {}
|
|
|
|
impl<T> ActorAndObjectRefExt for T where T: ActorAndObjectRef {}
|
|
|
|
impl<T> TargetRefExt for T where T: TargetRef {}
|
|
|
|
impl<T> OriginRefExt for T where T: OriginRef {}
|
|
|
|
impl<T> OptTargetRefExt for T where T: OptTargetRef {}
|
|
|
|
impl<T> OptOriginRefExt for T where T: OptOriginRef {}
|
|
|
|
impl<T> QuestionExt for T where T: AsQuestion {}
|