mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2024-11-22 03:40:59 +00:00
Add extension traits
This commit is contained in:
parent
677c8670ec
commit
16d06bf550
43 changed files with 915 additions and 101 deletions
|
@ -96,10 +96,8 @@ pub fn unit_string(input: TokenStream) -> TokenStream {
|
|||
.map(|segment| {
|
||||
let segment = segment.into_value();
|
||||
segment.ident == Ident::new("activitystreams", segment.ident.span())
|
||||
})
|
||||
.unwrap_or(false)
|
||||
})
|
||||
.unwrap()
|
||||
}).unwrap_or(false)
|
||||
}).unwrap()
|
||||
.clone();
|
||||
|
||||
let value = from_value(attr);
|
||||
|
@ -169,14 +167,14 @@ pub fn unit_string(input: TokenStream) -> TokenStream {
|
|||
}
|
||||
|
||||
fn from_value(attr: Attribute) -> String {
|
||||
let group = attr.tts
|
||||
let group = attr
|
||||
.tts
|
||||
.clone()
|
||||
.into_iter()
|
||||
.filter_map(|token_tree| match token_tree {
|
||||
TokenTree::Group(group) => Some(group),
|
||||
_ => None,
|
||||
})
|
||||
.next()
|
||||
}).next()
|
||||
.unwrap();
|
||||
|
||||
group
|
||||
|
@ -186,8 +184,7 @@ fn from_value(attr: Attribute) -> String {
|
|||
.filter_map(|token_tree| match token_tree {
|
||||
TokenTree::Term(term) => Some(term.as_str().to_owned()),
|
||||
_ => None,
|
||||
})
|
||||
.next()
|
||||
}).next()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
|
@ -608,14 +605,14 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
|
|||
}
|
||||
|
||||
fn variants(attr: Attribute) -> Vec<(String, bool)> {
|
||||
let group = attr.tts
|
||||
let group = attr
|
||||
.tts
|
||||
.clone()
|
||||
.into_iter()
|
||||
.filter_map(|token_tree| match token_tree {
|
||||
TokenTree::Group(group) => Some(group),
|
||||
_ => None,
|
||||
})
|
||||
.next()
|
||||
}).next()
|
||||
.unwrap();
|
||||
|
||||
let mut is_concrete = false;
|
||||
|
@ -636,20 +633,19 @@ fn variants(attr: Attribute) -> Vec<(String, bool)> {
|
|||
},
|
||||
)),
|
||||
_ => None,
|
||||
})
|
||||
.flat_map(|i| i)
|
||||
}).flat_map(|i| i)
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn is_functional(attr: Attribute) -> bool {
|
||||
let group = attr.tts
|
||||
let group = attr
|
||||
.tts
|
||||
.clone()
|
||||
.into_iter()
|
||||
.filter_map(|token_tree| match token_tree {
|
||||
TokenTree::Group(group) => Some(group),
|
||||
_ => None,
|
||||
})
|
||||
.next()
|
||||
}).next()
|
||||
.unwrap();
|
||||
|
||||
group
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::AcceptType, properties::{AcceptProperties, ActivityProperties},
|
||||
kind::AcceptType,
|
||||
properties::{AcceptProperties, ActivityExt, ActivityProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor accepts the object.
|
||||
///
|
||||
|
@ -48,4 +49,22 @@ pub struct Accept {
|
|||
}
|
||||
|
||||
impl Object for Accept {}
|
||||
impl ObjectExt for Accept {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Accept {}
|
||||
impl ActivityExt for Accept {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::AddType, properties::{ActivityProperties, AddProperties},
|
||||
kind::AddType,
|
||||
properties::{ActivityExt, ActivityProperties, AddProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor has added the object to the target.
|
||||
///
|
||||
|
@ -49,4 +50,22 @@ pub struct Add {
|
|||
}
|
||||
|
||||
impl Object for Add {}
|
||||
impl ObjectExt for Add {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Add {}
|
||||
impl ActivityExt for Add {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::MoveType, properties::{ActivityProperties, MoveProperties},
|
||||
kind::MoveType,
|
||||
properties::{ActivityExt, ActivityProperties, MoveProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor has moved object from origin to target.
|
||||
///
|
||||
|
@ -47,4 +48,22 @@ pub struct AMove {
|
|||
}
|
||||
|
||||
impl Object for AMove {}
|
||||
impl ObjectExt for AMove {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for AMove {}
|
||||
impl ActivityExt for AMove {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::AnnounceType, properties::{ActivityProperties, AnnounceProperties},
|
||||
kind::AnnounceType,
|
||||
properties::{ActivityExt, ActivityProperties, AnnounceProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor is calling the target's attention the object.
|
||||
///
|
||||
|
@ -47,4 +48,22 @@ pub struct Announce {
|
|||
}
|
||||
|
||||
impl Object for Announce {}
|
||||
impl ObjectExt for Announce {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Announce {}
|
||||
impl ActivityExt for Announce {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, IntransitiveActivity, Object};
|
||||
|
||||
use super::{
|
||||
kind::ArriveType, properties::{ActivityProperties, ArriveProperties},
|
||||
kind::ArriveType,
|
||||
properties::{ActivityExt, ActivityProperties, ArriveProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// An IntransitiveActivity that indicates that the actor has arrived at the location.
|
||||
///
|
||||
|
@ -48,5 +49,23 @@ pub struct Arrive {
|
|||
}
|
||||
|
||||
impl Object for Arrive {}
|
||||
impl ObjectExt for Arrive {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Arrive {}
|
||||
impl IntransitiveActivity for Arrive {}
|
||||
impl ActivityExt for Arrive {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::BlockType, properties::{ActivityProperties, BlockProperties},
|
||||
kind::BlockType,
|
||||
properties::{ActivityExt, ActivityProperties, BlockProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor is blocking the object.
|
||||
///
|
||||
|
@ -49,4 +50,22 @@ pub struct Block {
|
|||
}
|
||||
|
||||
impl Object for Block {}
|
||||
impl ObjectExt for Block {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Block {}
|
||||
impl ActivityExt for Block {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::CreateType, properties::{ActivityProperties, CreateProperties},
|
||||
kind::CreateType,
|
||||
properties::{ActivityExt, ActivityProperties, CreateProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor has created the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
||||
|
@ -45,4 +46,22 @@ pub struct Create {
|
|||
}
|
||||
|
||||
impl Object for Create {}
|
||||
impl ObjectExt for Create {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Create {}
|
||||
impl ActivityExt for Create {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::DeleteType, properties::{ActivityProperties, DeleteProperties},
|
||||
kind::DeleteType,
|
||||
properties::{ActivityExt, ActivityProperties, DeleteProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor has deleted the object.
|
||||
///
|
||||
|
@ -47,4 +48,22 @@ pub struct Delete {
|
|||
}
|
||||
|
||||
impl Object for Delete {}
|
||||
impl ObjectExt for Delete {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Delete {}
|
||||
impl ActivityExt for Delete {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::DislikeType, properties::{ActivityProperties, DislikeProperties},
|
||||
kind::DislikeType,
|
||||
properties::{ActivityExt, ActivityProperties, DislikeProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor dislikes the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
||||
|
@ -45,4 +46,22 @@ pub struct Dislike {
|
|||
}
|
||||
|
||||
impl Object for Dislike {}
|
||||
impl ObjectExt for Dislike {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Dislike {}
|
||||
impl ActivityExt for Dislike {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::FlagType, properties::{ActivityProperties, FlagProperties},
|
||||
kind::FlagType,
|
||||
properties::{ActivityExt, ActivityProperties, FlagProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor is "flagging" the object.
|
||||
///
|
||||
|
@ -48,4 +49,22 @@ pub struct Flag {
|
|||
}
|
||||
|
||||
impl Object for Flag {}
|
||||
impl ObjectExt for Flag {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Flag {}
|
||||
impl ActivityExt for Flag {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::FollowType, properties::{ActivityProperties, FollowProperties},
|
||||
kind::FollowType,
|
||||
properties::{ActivityExt, ActivityProperties, FollowProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor is "following" the object.
|
||||
///
|
||||
|
@ -49,4 +50,22 @@ pub struct Follow {
|
|||
}
|
||||
|
||||
impl Object for Follow {}
|
||||
impl ObjectExt for Follow {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Follow {}
|
||||
impl ActivityExt for Follow {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::IgnoreType, properties::{ActivityProperties, IgnoreProperties},
|
||||
kind::IgnoreType,
|
||||
properties::{ActivityExt, ActivityProperties, IgnoreProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor is ignoring the object.
|
||||
///
|
||||
|
@ -47,4 +48,22 @@ pub struct Ignore {
|
|||
}
|
||||
|
||||
impl Object for Ignore {}
|
||||
impl ObjectExt for Ignore {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Ignore {}
|
||||
impl ActivityExt for Ignore {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::InviteType, properties::{ActivityProperties, InviteProperties},
|
||||
kind::InviteType,
|
||||
properties::{ActivityExt, ActivityProperties, InviteProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// A specialization of Offer in which the actor is extending an invitation for the object to the
|
||||
/// target.
|
||||
|
@ -46,4 +47,22 @@ pub struct Invite {
|
|||
}
|
||||
|
||||
impl Object for Invite {}
|
||||
impl ObjectExt for Invite {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Invite {}
|
||||
impl ActivityExt for Invite {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::JoinType, properties::{ActivityProperties, JoinProperties},
|
||||
kind::JoinType,
|
||||
properties::{ActivityExt, ActivityProperties, JoinProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor has joined the object.
|
||||
///
|
||||
|
@ -47,4 +48,22 @@ pub struct Join {
|
|||
}
|
||||
|
||||
impl Object for Join {}
|
||||
impl ObjectExt for Join {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Join {}
|
||||
impl ActivityExt for Join {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::LeaveType, properties::{ActivityProperties, LeaveProperties},
|
||||
kind::LeaveType,
|
||||
properties::{ActivityExt, ActivityProperties, LeaveProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor has left the object.
|
||||
///
|
||||
|
@ -47,4 +48,22 @@ pub struct Leave {
|
|||
}
|
||||
|
||||
impl Object for Leave {}
|
||||
impl ObjectExt for Leave {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Leave {}
|
||||
impl ActivityExt for Leave {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::LikeType, properties::{ActivityProperties, LikeProperties},
|
||||
kind::LikeType,
|
||||
properties::{ActivityExt, ActivityProperties, LikeProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor likes, recommends or endorses the object.
|
||||
///
|
||||
|
@ -47,4 +48,22 @@ pub struct Like {
|
|||
}
|
||||
|
||||
impl Object for Like {}
|
||||
impl ObjectExt for Like {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Like {}
|
||||
impl ActivityExt for Like {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::ListenType, properties::{ActivityProperties, ListenProperties},
|
||||
kind::ListenType,
|
||||
properties::{ActivityExt, ActivityProperties, ListenProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor has listened to the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
||||
|
@ -45,4 +46,22 @@ pub struct Listen {
|
|||
}
|
||||
|
||||
impl Object for Listen {}
|
||||
impl ObjectExt for Listen {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Listen {}
|
||||
impl ActivityExt for Listen {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::OfferType, properties::{ActivityProperties, OfferProperties},
|
||||
kind::OfferType,
|
||||
properties::{ActivityExt, ActivityProperties, OfferProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor is offering the object.
|
||||
///
|
||||
|
@ -47,4 +48,22 @@ pub struct Offer {
|
|||
}
|
||||
|
||||
impl Object for Offer {}
|
||||
impl ObjectExt for Offer {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Offer {}
|
||||
impl ActivityExt for Offer {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,9 +56,14 @@
|
|||
//! # fn main() {}
|
||||
//! ```
|
||||
|
||||
use activitystreams_traits::{Link, Object};
|
||||
use activitystreams_traits::{Activity, Link, Object};
|
||||
use serde_json;
|
||||
|
||||
pub trait ActivityExt: Activity {
|
||||
fn props(&self) -> &ActivityProperties;
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties;
|
||||
}
|
||||
|
||||
/// Activity objects are specializations of the base Object type that provide information about
|
||||
/// actions that have either already occurred, are in the process of occurring, or may occur in the
|
||||
/// future.
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, IntransitiveActivity, Object};
|
||||
|
||||
use super::{
|
||||
kind::QuestionType, properties::{ActivityProperties, QuestionProperties},
|
||||
kind::QuestionType,
|
||||
properties::{ActivityExt, ActivityProperties, QuestionProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Represents a question being asked.
|
||||
///
|
||||
|
@ -52,5 +53,23 @@ pub struct Question {
|
|||
}
|
||||
|
||||
impl Object for Question {}
|
||||
impl ObjectExt for Question {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Question {}
|
||||
impl ActivityExt for Question {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
impl IntransitiveActivity for Question {}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::ReadType, properties::{ActivityProperties, ReadProperties},
|
||||
kind::ReadType,
|
||||
properties::{ActivityExt, ActivityProperties, ReadProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor has read the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
||||
|
@ -45,4 +46,22 @@ pub struct Read {
|
|||
}
|
||||
|
||||
impl Object for Read {}
|
||||
impl ObjectExt for Read {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Read {}
|
||||
impl ActivityExt for Read {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::RejectType, properties::{ActivityProperties, RejectProperties},
|
||||
kind::RejectType,
|
||||
properties::{ActivityExt, ActivityProperties, RejectProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor is rejecting the object.
|
||||
///
|
||||
|
@ -47,4 +48,22 @@ pub struct Reject {
|
|||
}
|
||||
|
||||
impl Object for Reject {}
|
||||
impl ObjectExt for Reject {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Reject {}
|
||||
impl ActivityExt for Reject {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::RemoveType, properties::{ActivityProperties, RemoveProperties},
|
||||
kind::RemoveType,
|
||||
properties::{ActivityExt, ActivityProperties, RemoveProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor is removing the object.
|
||||
///
|
||||
|
@ -47,4 +48,22 @@ pub struct Remove {
|
|||
}
|
||||
|
||||
impl Object for Remove {}
|
||||
impl ObjectExt for Remove {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Remove {}
|
||||
impl ActivityExt for Remove {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::TentativeAcceptType, properties::{ActivityProperties, TentativeAcceptProperties},
|
||||
kind::TentativeAcceptType,
|
||||
properties::{ActivityExt, ActivityProperties, TentativeAcceptProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// A specialization of Accept indicating that the acceptance is tentative.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
||||
|
@ -45,4 +46,22 @@ pub struct TentativeAccept {
|
|||
}
|
||||
|
||||
impl Object for TentativeAccept {}
|
||||
impl ObjectExt for TentativeAccept {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for TentativeAccept {}
|
||||
impl ActivityExt for TentativeAccept {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::TentativeRejectType, properties::{ActivityProperties, TentativeRejectProperties},
|
||||
kind::TentativeRejectType,
|
||||
properties::{ActivityExt, ActivityProperties, TentativeRejectProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// A specialization of Reject in which the rejection is considered tentative.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
||||
|
@ -45,4 +46,22 @@ pub struct TentativeReject {
|
|||
}
|
||||
|
||||
impl Object for TentativeReject {}
|
||||
impl ObjectExt for TentativeReject {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for TentativeReject {}
|
||||
impl ActivityExt for TentativeReject {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, IntransitiveActivity, Object};
|
||||
|
||||
use super::{
|
||||
kind::TravelType, properties::{ActivityProperties, TravelProperties},
|
||||
kind::TravelType,
|
||||
properties::{ActivityExt, ActivityProperties, TravelProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor is traveling to target from origin.
|
||||
///
|
||||
|
@ -48,5 +49,23 @@ pub struct Travel {
|
|||
}
|
||||
|
||||
impl Object for Travel {}
|
||||
impl ObjectExt for Travel {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Travel {}
|
||||
impl ActivityExt for Travel {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
impl IntransitiveActivity for Travel {}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::UndoType, properties::{ActivityProperties, UndoProperties},
|
||||
kind::UndoType,
|
||||
properties::{ActivityExt, ActivityProperties, UndoProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor is undoing the object.
|
||||
///
|
||||
|
@ -51,4 +52,22 @@ pub struct Undo {
|
|||
}
|
||||
|
||||
impl Object for Undo {}
|
||||
impl ObjectExt for Undo {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Undo {}
|
||||
impl ActivityExt for Undo {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::UpdateType, properties::{ActivityProperties, UpdateProperties},
|
||||
kind::UpdateType,
|
||||
properties::{ActivityExt, ActivityProperties, UpdateProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor has updated the object.
|
||||
///
|
||||
|
@ -50,4 +51,22 @@ pub struct Update {
|
|||
}
|
||||
|
||||
impl Object for Update {}
|
||||
impl ObjectExt for Update {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for Update {}
|
||||
impl ActivityExt for Update {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
use activitystreams_traits::{Activity, Object};
|
||||
|
||||
use super::{
|
||||
kind::ViewType, properties::{ActivityProperties, ViewProperties},
|
||||
kind::ViewType,
|
||||
properties::{ActivityExt, ActivityProperties, ViewProperties},
|
||||
};
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
/// Indicates that the actor has viewed the object.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
||||
|
@ -45,4 +46,22 @@ pub struct View {
|
|||
}
|
||||
|
||||
impl Object for View {}
|
||||
impl ObjectExt for View {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Activity for View {}
|
||||
impl ActivityExt for View {
|
||||
fn props(&self) -> &ActivityProperties {
|
||||
&self.activity_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ActivityProperties {
|
||||
&mut self.activity_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
use activitystreams_traits::{Actor, Object};
|
||||
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
pub mod kind;
|
||||
use self::kind::*;
|
||||
|
@ -39,6 +39,15 @@ pub struct Application {
|
|||
}
|
||||
|
||||
impl Object for Application {}
|
||||
impl ObjectExt for Application {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Actor for Application {}
|
||||
|
||||
/// Represents a formal or informal collective of Actors.
|
||||
|
@ -54,6 +63,15 @@ pub struct Group {
|
|||
}
|
||||
|
||||
impl Object for Group {}
|
||||
impl ObjectExt for Group {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Actor for Group {}
|
||||
|
||||
/// Represents an organization.
|
||||
|
@ -69,6 +87,15 @@ pub struct Organization {
|
|||
}
|
||||
|
||||
impl Object for Organization {}
|
||||
impl ObjectExt for Organization {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Actor for Organization {}
|
||||
|
||||
/// Represents an individual person.
|
||||
|
@ -84,6 +111,15 @@ pub struct Person {
|
|||
}
|
||||
|
||||
impl Object for Person {}
|
||||
impl ObjectExt for Person {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Actor for Person {}
|
||||
|
||||
/// Represents a service of any kind.
|
||||
|
@ -99,4 +135,13 @@ pub struct Service {
|
|||
}
|
||||
|
||||
impl Object for Service {}
|
||||
impl ObjectExt for Service {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Actor for Service {}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
use activitystreams_traits::{Collection, CollectionPage, Object};
|
||||
|
||||
use object::properties::ObjectProperties;
|
||||
use object::properties::{ObjectExt, ObjectProperties};
|
||||
|
||||
pub mod kind;
|
||||
pub mod properties;
|
||||
|
@ -45,7 +45,25 @@ pub struct UnorderedCollection {
|
|||
}
|
||||
|
||||
impl Object for UnorderedCollection {}
|
||||
impl ObjectExt for UnorderedCollection {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Collection for UnorderedCollection {}
|
||||
impl CollectionExt for UnorderedCollection {
|
||||
fn props(&self) -> &CollectionProperties {
|
||||
&self.collection_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut CollectionProperties {
|
||||
&mut self.collection_props
|
||||
}
|
||||
}
|
||||
|
||||
/// A subtype of `Collection` in which members of the logical collection are assumed to always be
|
||||
/// strictly ordered.
|
||||
|
@ -65,7 +83,25 @@ pub struct OrderedCollection {
|
|||
}
|
||||
|
||||
impl Object for OrderedCollection {}
|
||||
impl ObjectExt for OrderedCollection {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Collection for OrderedCollection {}
|
||||
impl CollectionExt for OrderedCollection {
|
||||
fn props(&self) -> &CollectionProperties {
|
||||
&self.collection_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut CollectionProperties {
|
||||
&mut self.collection_props
|
||||
}
|
||||
}
|
||||
|
||||
/// Used to represent distinct subsets of items from a `Collection`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
||||
|
@ -88,8 +124,35 @@ pub struct UnorderedCollectionPage {
|
|||
}
|
||||
|
||||
impl Object for UnorderedCollectionPage {}
|
||||
impl ObjectExt for UnorderedCollectionPage {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Collection for UnorderedCollectionPage {}
|
||||
impl CollectionExt for UnorderedCollectionPage {
|
||||
fn props(&self) -> &CollectionProperties {
|
||||
&self.collection_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut CollectionProperties {
|
||||
&mut self.collection_props
|
||||
}
|
||||
}
|
||||
impl CollectionPage for UnorderedCollectionPage {}
|
||||
impl CollectionPageExt for UnorderedCollectionPage {
|
||||
fn props(&self) -> &CollectionPageProperties {
|
||||
&self.collection_page_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut CollectionPageProperties {
|
||||
&mut self.collection_page_props
|
||||
}
|
||||
}
|
||||
|
||||
/// Used to represent ordered subsets of items from an `OrderedCollection`.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
|
||||
|
@ -116,5 +179,32 @@ pub struct OrderedCollectionPage {
|
|||
}
|
||||
|
||||
impl Object for OrderedCollectionPage {}
|
||||
impl ObjectExt for OrderedCollectionPage {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
impl Collection for OrderedCollectionPage {}
|
||||
impl CollectionExt for OrderedCollectionPage {
|
||||
fn props(&self) -> &CollectionProperties {
|
||||
&self.collection_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut CollectionProperties {
|
||||
&mut self.collection_props
|
||||
}
|
||||
}
|
||||
impl CollectionPage for OrderedCollectionPage {}
|
||||
impl CollectionPageExt for OrderedCollectionPage {
|
||||
fn props(&self) -> &CollectionPageProperties {
|
||||
&self.collection_page_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut CollectionPageProperties {
|
||||
&mut self.collection_page_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,16 @@
|
|||
use activitystreams_traits::{Collection, CollectionPage, Link, Object};
|
||||
use serde_json;
|
||||
|
||||
pub trait CollectionExt {
|
||||
fn props(&self) -> &CollectionProperties;
|
||||
fn props_mut(&mut self) -> &mut CollectionProperties;
|
||||
}
|
||||
|
||||
pub trait CollectionPageExt {
|
||||
fn props(&self) -> &CollectionPageProperties;
|
||||
fn props_mut(&mut self) -> &mut CollectionPageProperties;
|
||||
}
|
||||
|
||||
/// `Collection` objects are a specialization of the base `Object` that serve as a container for
|
||||
/// other `Objects` or `Links`.
|
||||
///
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
|
||||
use serde::{de::DeserializeOwned, ser::Serialize};
|
||||
|
||||
use activitystreams_traits::{Activity, Actor, Collection, CollectionPage, IntransitiveActivity,
|
||||
Link, Object};
|
||||
use activitystreams_traits::{
|
||||
Activity, Actor, Collection, CollectionPage, IntransitiveActivity, Link, Object,
|
||||
};
|
||||
|
||||
/// A custom type extending Link
|
||||
///
|
||||
|
@ -127,23 +128,19 @@ impl<C, O> Collection for CustomObject<C, O>
|
|||
where
|
||||
C: DeserializeOwned + Serialize,
|
||||
O: Collection,
|
||||
{
|
||||
}
|
||||
{}
|
||||
impl<C, O> CollectionPage for CustomObject<C, O>
|
||||
where
|
||||
C: DeserializeOwned + Serialize,
|
||||
O: CollectionPage,
|
||||
{
|
||||
}
|
||||
{}
|
||||
impl<C, O> Activity for CustomObject<C, O>
|
||||
where
|
||||
C: DeserializeOwned + Serialize,
|
||||
O: Activity,
|
||||
{
|
||||
}
|
||||
{}
|
||||
impl<C, O> IntransitiveActivity for CustomObject<C, O>
|
||||
where
|
||||
C: DeserializeOwned + Serialize,
|
||||
O: IntransitiveActivity,
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
|
|
@ -39,3 +39,12 @@ pub struct Mention {
|
|||
}
|
||||
|
||||
impl Link for Mention {}
|
||||
impl LinkExt for Mention {
|
||||
fn props(&self) -> &LinkProperties {
|
||||
&self.link_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut LinkProperties {
|
||||
&mut self.link_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,11 @@ use activitystreams_traits::{Error, Link, Object, Result};
|
|||
use mime;
|
||||
use serde_json;
|
||||
|
||||
pub trait LinkExt {
|
||||
fn props(&self) -> &LinkProperties;
|
||||
fn props_mut(&mut self) -> &mut LinkProperties;
|
||||
}
|
||||
|
||||
/// Define all the properties of the Object base type as described by the Activity Streams
|
||||
/// vocabulary.
|
||||
///
|
||||
|
|
|
@ -39,6 +39,15 @@ pub struct Article {
|
|||
}
|
||||
|
||||
impl Object for Article {}
|
||||
impl ObjectExt for Article {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents an audio document of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
|
@ -53,6 +62,15 @@ pub struct Audio {
|
|||
}
|
||||
|
||||
impl Object for Audio {}
|
||||
impl ObjectExt for Audio {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a document of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
|
@ -67,6 +85,15 @@ pub struct Document {
|
|||
}
|
||||
|
||||
impl Object for Document {}
|
||||
impl ObjectExt for Document {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents any kind of event.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
|
@ -81,6 +108,15 @@ pub struct Event {
|
|||
}
|
||||
|
||||
impl Object for Event {}
|
||||
impl ObjectExt for Event {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// An image document of any kind
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
|
@ -95,6 +131,15 @@ pub struct Image {
|
|||
}
|
||||
|
||||
impl Object for Image {}
|
||||
impl ObjectExt for Image {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a short written work typically less than a single paragraph in length.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
|
@ -109,6 +154,15 @@ pub struct Note {
|
|||
}
|
||||
|
||||
impl Object for Note {}
|
||||
impl ObjectExt for Note {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a Web Page.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
|
@ -123,6 +177,15 @@ pub struct Page {
|
|||
}
|
||||
|
||||
impl Object for Page {}
|
||||
impl ObjectExt for Page {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a logical or physical location.
|
||||
///
|
||||
|
@ -158,6 +221,15 @@ pub struct Place {
|
|||
}
|
||||
|
||||
impl Object for Place {}
|
||||
impl ObjectExt for Place {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// A Profile is a content object that describes another `Object`, typically used to describe
|
||||
/// `Actor` Type objects.
|
||||
|
@ -179,6 +251,15 @@ pub struct Profile {
|
|||
}
|
||||
|
||||
impl Object for Profile {}
|
||||
impl ObjectExt for Profile {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes a relationship between two individuals.
|
||||
///
|
||||
|
@ -210,6 +291,15 @@ pub struct Relationship {
|
|||
}
|
||||
|
||||
impl Object for Relationship {}
|
||||
impl ObjectExt for Relationship {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// A Tombstone represents a content object that has been deleted.
|
||||
///
|
||||
|
@ -231,6 +321,15 @@ pub struct Tombstone {
|
|||
}
|
||||
|
||||
impl Object for Tombstone {}
|
||||
impl ObjectExt for Tombstone {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a video document of any kind.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
|
@ -245,3 +344,12 @@ pub struct Video {
|
|||
}
|
||||
|
||||
impl Object for Video {}
|
||||
impl ObjectExt for Video {
|
||||
fn props(&self) -> &ObjectProperties {
|
||||
&self.object_props
|
||||
}
|
||||
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties {
|
||||
&mut self.object_props
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,11 @@ use serde_json;
|
|||
|
||||
use object::Image;
|
||||
|
||||
pub trait ObjectExt {
|
||||
fn props(&self) -> &ObjectProperties;
|
||||
fn props_mut(&mut self) -> &mut ObjectProperties;
|
||||
}
|
||||
|
||||
/// Alias chrono::DateTime<Utc> for use in derive macros
|
||||
pub type UtcTime = DateTime<Utc>;
|
||||
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
//! Activity traits and types
|
||||
|
||||
pub use activitystreams_traits::{Activity, IntransitiveActivity};
|
||||
pub use activitystreams_types::activity::{kind, properties, AMove, Accept, Add, Announce, Arrive,
|
||||
Block, Create, Delete, Dislike, Flag, Follow, Ignore,
|
||||
Invite, Join, Leave, Like, Listen, Offer, Question,
|
||||
Read, Reject, Remove, TentativeAccept, TentativeReject,
|
||||
Travel, Undo, Update, View};
|
||||
pub use activitystreams_types::activity::{
|
||||
kind,
|
||||
properties::{self, ActivityExt},
|
||||
AMove, Accept, Add, Announce, Arrive, Block, Create, Delete, Dislike, Flag, Follow, Ignore,
|
||||
Invite, Join, Leave, Like, Listen, Offer, Question, Read, Reject, Remove, TentativeAccept,
|
||||
TentativeReject, Travel, Undo, Update, View,
|
||||
};
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
//! Collection traits and types
|
||||
|
||||
pub use activitystreams_traits::{Collection, CollectionPage};
|
||||
pub use activitystreams_types::collection::{kind, properties, OrderedCollection,
|
||||
OrderedCollectionPage, UnorderedCollection,
|
||||
UnorderedCollectionPage};
|
||||
pub use activitystreams_types::collection::{
|
||||
kind,
|
||||
properties::{self, CollectionExt, CollectionPageExt},
|
||||
OrderedCollection, OrderedCollectionPage, UnorderedCollection, UnorderedCollectionPage,
|
||||
};
|
||||
|
|
|
@ -148,11 +148,11 @@ mod error;
|
|||
pub mod link;
|
||||
pub mod object;
|
||||
|
||||
pub use self::activity::{Activity, IntransitiveActivity};
|
||||
pub use self::activity::{Activity, ActivityExt, IntransitiveActivity};
|
||||
pub use self::actor::Actor;
|
||||
pub use self::collection::{Collection, CollectionPage};
|
||||
pub use self::collection::{Collection, CollectionExt, CollectionPage, CollectionPageExt};
|
||||
pub use self::error::{Error, Result};
|
||||
pub use self::link::Link;
|
||||
pub use self::object::Object;
|
||||
pub use self::link::{Link, LinkExt};
|
||||
pub use self::object::{Object, ObjectExt};
|
||||
pub use activitystreams_traits::properties;
|
||||
pub use activitystreams_types::context;
|
||||
|
|
|
@ -20,4 +20,8 @@
|
|||
//! Link traits and types
|
||||
|
||||
pub use activitystreams_traits::Link;
|
||||
pub use activitystreams_types::link::{kind, properties, Mention};
|
||||
pub use activitystreams_types::link::{
|
||||
kind,
|
||||
properties::{self, LinkExt},
|
||||
Mention,
|
||||
};
|
||||
|
|
|
@ -20,5 +20,9 @@
|
|||
//! Object traits and types
|
||||
|
||||
pub use activitystreams_traits::Object;
|
||||
pub use activitystreams_types::object::{kind, properties, Article, Audio, Document, Event, Image,
|
||||
Note, Page, Place, Profile, Relationship, Tombstone, Video};
|
||||
pub use activitystreams_types::object::{
|
||||
kind,
|
||||
properties::{self, ObjectExt},
|
||||
Article, Audio, Document, Event, Image, Note, Page, Place, Profile, Relationship, Tombstone,
|
||||
Video,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue