mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2024-11-25 13:21:00 +00:00
Remove extension traits
This commit is contained in:
parent
a958b17f90
commit
119baceffa
43 changed files with 57 additions and 156 deletions
|
@ -110,8 +110,7 @@ use syn::{
|
||||||
/// #[activitystreams(None)]
|
/// #[activitystreams(None)]
|
||||||
/// my_field: MyProperties,
|
/// my_field: MyProperties,
|
||||||
///
|
///
|
||||||
/// /// Derive the above, plus Object (activitystreams-traits) and ObjectExt
|
/// /// Derive the above, plus Object (activitystreams-traits)
|
||||||
/// /// (activitystreams-types)
|
|
||||||
/// #[activitystreams(Object)]
|
/// #[activitystreams(Object)]
|
||||||
/// obj_field: ObjectProperties,
|
/// obj_field: ObjectProperties,
|
||||||
/// }
|
/// }
|
||||||
|
@ -158,7 +157,6 @@ pub fn ref_derive(input: TokenStream) -> TokenStream {
|
||||||
.flat_map(move |(ident, ty, attr)| {
|
.flat_map(move |(ident, ty, attr)| {
|
||||||
let object = from_value(attr);
|
let object = from_value(attr);
|
||||||
let name = name.clone();
|
let name = name.clone();
|
||||||
let ext_trait = Ident::new(&format!("{}Ext", object), name.span());
|
|
||||||
|
|
||||||
let base_impl = if object.to_string() == "Object" || object.to_string() == "Link" {
|
let base_impl = if object.to_string() == "Object" || object.to_string() == "Link" {
|
||||||
quote! {
|
quote! {
|
||||||
|
@ -183,20 +181,6 @@ pub fn ref_derive(input: TokenStream) -> TokenStream {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let activity_impls = quote! {
|
|
||||||
#base_impl
|
|
||||||
|
|
||||||
impl #ext_trait for #name {
|
|
||||||
fn props(&self) -> &#ty {
|
|
||||||
self.as_ref()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn props_mut(&mut self) -> &mut #ty {
|
|
||||||
self.as_mut()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let ref_impls = quote! {
|
let ref_impls = quote! {
|
||||||
impl AsRef<#ty> for #name {
|
impl AsRef<#ty> for #name {
|
||||||
fn as_ref(&self) -> &#ty {
|
fn as_ref(&self) -> &#ty {
|
||||||
|
@ -216,7 +200,7 @@ pub fn ref_derive(input: TokenStream) -> TokenStream {
|
||||||
} else {
|
} else {
|
||||||
quote! {
|
quote! {
|
||||||
#ref_impls
|
#ref_impls
|
||||||
#activity_impls
|
#base_impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::AcceptType,
|
kind::AcceptType,
|
||||||
properties::{AcceptProperties, ActivityProperties},
|
properties::{AcceptProperties, ActivityProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor accepts the object.
|
/// Indicates that the actor accepts the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::AddType,
|
kind::AddType,
|
||||||
properties::{ActivityProperties, AddProperties},
|
properties::{ActivityProperties, AddProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor has added the object to the target.
|
/// Indicates that the actor has added the object to the target.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::MoveType,
|
kind::MoveType,
|
||||||
properties::{ActivityProperties, MoveProperties},
|
properties::{ActivityProperties, MoveProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor has moved object from origin to target.
|
/// Indicates that the actor has moved object from origin to target.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::AnnounceType,
|
kind::AnnounceType,
|
||||||
properties::{ActivityProperties, AnnounceProperties},
|
properties::{ActivityProperties, AnnounceProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor is calling the target's attention the object.
|
/// Indicates that the actor is calling the target's attention the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::ArriveType,
|
kind::ArriveType,
|
||||||
properties::{ActivityProperties, ArriveProperties},
|
properties::{ActivityProperties, ArriveProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// An IntransitiveActivity that indicates that the actor has arrived at the location.
|
/// An IntransitiveActivity that indicates that the actor has arrived at the location.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::BlockType,
|
kind::BlockType,
|
||||||
properties::{ActivityProperties, BlockProperties},
|
properties::{ActivityProperties, BlockProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor is blocking the object.
|
/// Indicates that the actor is blocking the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::CreateType,
|
kind::CreateType,
|
||||||
properties::{ActivityProperties, CreateProperties},
|
properties::{ActivityProperties, CreateProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor has created the object.
|
/// Indicates that the actor has created the object.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::DeleteType,
|
kind::DeleteType,
|
||||||
properties::{ActivityProperties, DeleteProperties},
|
properties::{ActivityProperties, DeleteProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor has deleted the object.
|
/// Indicates that the actor has deleted the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::DislikeType,
|
kind::DislikeType,
|
||||||
properties::{ActivityProperties, DislikeProperties},
|
properties::{ActivityProperties, DislikeProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor dislikes the object.
|
/// Indicates that the actor dislikes the object.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::FlagType,
|
kind::FlagType,
|
||||||
properties::{ActivityProperties, FlagProperties},
|
properties::{ActivityProperties, FlagProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor is "flagging" the object.
|
/// Indicates that the actor is "flagging" the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::FollowType,
|
kind::FollowType,
|
||||||
properties::{ActivityProperties, FollowProperties},
|
properties::{ActivityProperties, FollowProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor is "following" the object.
|
/// Indicates that the actor is "following" the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::IgnoreType,
|
kind::IgnoreType,
|
||||||
properties::{ActivityProperties, IgnoreProperties},
|
properties::{ActivityProperties, IgnoreProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor is ignoring the object.
|
/// Indicates that the actor is ignoring the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::InviteType,
|
kind::InviteType,
|
||||||
properties::{ActivityProperties, InviteProperties},
|
properties::{ActivityProperties, InviteProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// A specialization of Offer in which the actor is extending an invitation for the object to the
|
/// A specialization of Offer in which the actor is extending an invitation for the object to the
|
||||||
/// target.
|
/// target.
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::JoinType,
|
kind::JoinType,
|
||||||
properties::{ActivityProperties, JoinProperties},
|
properties::{ActivityProperties, JoinProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor has joined the object.
|
/// Indicates that the actor has joined the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::LeaveType,
|
kind::LeaveType,
|
||||||
properties::{ActivityProperties, LeaveProperties},
|
properties::{ActivityProperties, LeaveProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor has left the object.
|
/// Indicates that the actor has left the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::LikeType,
|
kind::LikeType,
|
||||||
properties::{ActivityProperties, LikeProperties},
|
properties::{ActivityProperties, LikeProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor likes, recommends or endorses the object.
|
/// Indicates that the actor likes, recommends or endorses the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::ListenType,
|
kind::ListenType,
|
||||||
properties::{ActivityProperties, ListenProperties},
|
properties::{ActivityProperties, ListenProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor has listened to the object.
|
/// Indicates that the actor has listened to the object.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||||
|
|
|
@ -49,20 +49,10 @@ mod update;
|
||||||
mod view;
|
mod view;
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
accept::*, add::*, amove::*, announce::*, arrive::*, block::*, create::*, delete::*,
|
accept::Accept, add::Add, amove::AMove, announce::Announce, arrive::Arrive, block::Block,
|
||||||
dislike::*, flag::*, follow::*, ignore::*, invite::*, join::*, leave::*, like::*, listen::*,
|
create::Create, delete::Delete, dislike::Dislike, flag::Flag, follow::Follow, ignore::Ignore,
|
||||||
offer::*, question::*, read::*, reject::*, remove::*, tentative_accept::*, tentative_reject::*,
|
invite::Invite, join::Join, leave::Leave, like::Like, listen::Listen, offer::Offer,
|
||||||
travel::*, undo::*, update::*, view::*,
|
question::Question, read::Read, reject::Reject, remove::Remove,
|
||||||
|
tentative_accept::TentativeAccept, tentative_reject::TentativeReject, travel::Travel,
|
||||||
|
undo::Undo, update::Update, view::View,
|
||||||
};
|
};
|
||||||
|
|
||||||
use activitystreams_traits::Activity;
|
|
||||||
|
|
||||||
use self::properties::ActivityProperties;
|
|
||||||
|
|
||||||
/// The Activity Extension Trait
|
|
||||||
///
|
|
||||||
/// This trait provides generic access to an activity's properties
|
|
||||||
pub trait ActivityExt: Activity {
|
|
||||||
fn props(&self) -> &ActivityProperties;
|
|
||||||
fn props_mut(&mut self) -> &mut ActivityProperties;
|
|
||||||
}
|
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::OfferType,
|
kind::OfferType,
|
||||||
properties::{ActivityProperties, OfferProperties},
|
properties::{ActivityProperties, OfferProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor is offering the object.
|
/// Indicates that the actor is offering the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,14 +24,8 @@
|
||||||
//! use activitystreams_derive::PropRefs;
|
//! use activitystreams_derive::PropRefs;
|
||||||
//! use activitystreams_traits::{Activity, Object};
|
//! use activitystreams_traits::{Activity, Object};
|
||||||
//! use activitystreams_types::{
|
//! use activitystreams_types::{
|
||||||
//! activity::{
|
//! activity::properties::ActivityProperties,
|
||||||
//! properties::ActivityProperties,
|
//! object::properties::ObjectProperties,
|
||||||
//! ActivityExt,
|
|
||||||
//! },
|
|
||||||
//! object::{
|
|
||||||
//! properties::ObjectProperties,
|
|
||||||
//! ObjectExt,
|
|
||||||
//! },
|
|
||||||
//! };
|
//! };
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use serde::{Deserialize, Serialize};
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::QuestionType,
|
kind::QuestionType,
|
||||||
properties::{ActivityProperties, QuestionProperties},
|
properties::{ActivityProperties, QuestionProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Represents a question being asked.
|
/// Represents a question being asked.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::ReadType,
|
kind::ReadType,
|
||||||
properties::{ActivityProperties, ReadProperties},
|
properties::{ActivityProperties, ReadProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor has read the object.
|
/// Indicates that the actor has read the object.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::RejectType,
|
kind::RejectType,
|
||||||
properties::{ActivityProperties, RejectProperties},
|
properties::{ActivityProperties, RejectProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor is rejecting the object.
|
/// Indicates that the actor is rejecting the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::RemoveType,
|
kind::RemoveType,
|
||||||
properties::{ActivityProperties, RemoveProperties},
|
properties::{ActivityProperties, RemoveProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor is removing the object.
|
/// Indicates that the actor is removing the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::TentativeAcceptType,
|
kind::TentativeAcceptType,
|
||||||
properties::{ActivityProperties, TentativeAcceptProperties},
|
properties::{ActivityProperties, TentativeAcceptProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// A specialization of Accept indicating that the acceptance is tentative.
|
/// A specialization of Accept indicating that the acceptance is tentative.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::TentativeRejectType,
|
kind::TentativeRejectType,
|
||||||
properties::{ActivityProperties, TentativeRejectProperties},
|
properties::{ActivityProperties, TentativeRejectProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// A specialization of Reject in which the rejection is considered tentative.
|
/// A specialization of Reject in which the rejection is considered tentative.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::TravelType,
|
kind::TravelType,
|
||||||
properties::{ActivityProperties, TravelProperties},
|
properties::{ActivityProperties, TravelProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor is traveling to target from origin.
|
/// Indicates that the actor is traveling to target from origin.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::UndoType,
|
kind::UndoType,
|
||||||
properties::{ActivityProperties, UndoProperties},
|
properties::{ActivityProperties, UndoProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor is undoing the object.
|
/// Indicates that the actor is undoing the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::UpdateType,
|
kind::UpdateType,
|
||||||
properties::{ActivityProperties, UpdateProperties},
|
properties::{ActivityProperties, UpdateProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor has updated the object.
|
/// Indicates that the actor has updated the object.
|
||||||
///
|
///
|
||||||
|
|
|
@ -24,9 +24,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::{
|
use super::{
|
||||||
kind::ViewType,
|
kind::ViewType,
|
||||||
properties::{ActivityProperties, ViewProperties},
|
properties::{ActivityProperties, ViewProperties},
|
||||||
ActivityExt,
|
|
||||||
};
|
};
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
/// Indicates that the actor has viewed the object.
|
/// Indicates that the actor has viewed the object.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize, PropRefs)]
|
||||||
|
|
|
@ -23,7 +23,7 @@ use activitystreams_derive::PropRefs;
|
||||||
use activitystreams_traits::{Actor, Object};
|
use activitystreams_traits::{Actor, Object};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
pub mod kind;
|
pub mod kind;
|
||||||
use self::kind::*;
|
use self::kind::*;
|
||||||
|
|
|
@ -23,29 +23,13 @@ use activitystreams_derive::PropRefs;
|
||||||
use activitystreams_traits::{Collection, CollectionPage, Object};
|
use activitystreams_traits::{Collection, CollectionPage, Object};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::object::{properties::ObjectProperties, ObjectExt};
|
use crate::object::properties::ObjectProperties;
|
||||||
|
|
||||||
pub mod kind;
|
pub mod kind;
|
||||||
pub mod properties;
|
pub mod properties;
|
||||||
use self::kind::*;
|
use self::kind::*;
|
||||||
use self::properties::*;
|
use self::properties::*;
|
||||||
|
|
||||||
/// The Collection Extension Trait
|
|
||||||
///
|
|
||||||
/// This trait provides generic access to a collection's properties
|
|
||||||
pub trait CollectionExt: Collection {
|
|
||||||
fn props(&self) -> &CollectionProperties;
|
|
||||||
fn props_mut(&mut self) -> &mut CollectionProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The Collection Page Extension Trait
|
|
||||||
///
|
|
||||||
/// This trait provides generic access to a collection page's properties
|
|
||||||
pub trait CollectionPageExt: CollectionPage {
|
|
||||||
fn props(&self) -> &CollectionPageProperties;
|
|
||||||
fn props_mut(&mut self) -> &mut CollectionPageProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(transparent)]
|
#[serde(transparent)]
|
||||||
pub struct CollectionBox(pub Box<dyn Object>);
|
pub struct CollectionBox(pub Box<dyn Object>);
|
||||||
|
|
|
@ -25,14 +25,8 @@
|
||||||
//! use activitystreams_derive::PropRefs;
|
//! use activitystreams_derive::PropRefs;
|
||||||
//! use activitystreams_traits::{Collection, Object};
|
//! use activitystreams_traits::{Collection, Object};
|
||||||
//! use activitystreams_types::{
|
//! use activitystreams_types::{
|
||||||
//! collection::{
|
//! collection::properties::CollectionProperties,
|
||||||
//! properties::CollectionProperties,
|
//! object::properties::ObjectProperties,
|
||||||
//! CollectionExt,
|
|
||||||
//! },
|
|
||||||
//! object::{
|
|
||||||
//! properties::ObjectProperties,
|
|
||||||
//! ObjectExt,
|
|
||||||
//! },
|
|
||||||
//! };
|
//! };
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use serde::{Deserialize, Serialize};
|
||||||
//! use std::any::Any;
|
//! use std::any::Any;
|
||||||
|
|
|
@ -28,14 +28,6 @@ pub mod properties;
|
||||||
use self::kind::*;
|
use self::kind::*;
|
||||||
use self::properties::*;
|
use self::properties::*;
|
||||||
|
|
||||||
/// The Link Extension Trait
|
|
||||||
///
|
|
||||||
/// This trait provides generic access to a link's properties
|
|
||||||
pub trait LinkExt: Link {
|
|
||||||
fn props(&self) -> &LinkProperties;
|
|
||||||
fn props_mut(&mut self) -> &mut LinkProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(transparent)]
|
#[serde(transparent)]
|
||||||
pub struct LinkBox(pub Box<dyn Link>);
|
pub struct LinkBox(pub Box<dyn Link>);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use activitystreams_derive::PropRefs;
|
//! use activitystreams_derive::PropRefs;
|
||||||
//! use activitystreams_traits::Link;
|
//! use activitystreams_traits::Link;
|
||||||
//! use activitystreams_types::link::{properties::LinkProperties, LinkExt};
|
//! use activitystreams_types::link::properties::LinkProperties;
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use serde::{Deserialize, Serialize};
|
||||||
//! use std::any::Any;
|
//! use std::any::Any;
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -28,14 +28,6 @@ pub mod properties;
|
||||||
use self::kind::*;
|
use self::kind::*;
|
||||||
use self::properties::*;
|
use self::properties::*;
|
||||||
|
|
||||||
/// The Object Extension Trait
|
|
||||||
///
|
|
||||||
/// This trait provides generic access to an object's properties
|
|
||||||
pub trait ObjectExt: Object {
|
|
||||||
fn props(&self) -> &ObjectProperties;
|
|
||||||
fn props_mut(&mut self) -> &mut ObjectProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[serde(transparent)]
|
#[serde(transparent)]
|
||||||
pub struct ImageBox(pub Box<Image>);
|
pub struct ImageBox(pub Box<Image>);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use activitystreams_derive::PropRefs;
|
//! use activitystreams_derive::PropRefs;
|
||||||
//! use activitystreams_traits::Object;
|
//! use activitystreams_traits::Object;
|
||||||
//! use activitystreams_types::object::{properties::ObjectProperties, ObjectExt};
|
//! use activitystreams_types::object::properties::ObjectProperties;
|
||||||
//! use serde::{Deserialize, Serialize};
|
//! use serde::{Deserialize, Serialize};
|
||||||
//! use std::any::Any;
|
//! use std::any::Any;
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
pub use activitystreams_traits::{Activity, IntransitiveActivity};
|
pub use activitystreams_traits::{Activity, IntransitiveActivity};
|
||||||
pub use activitystreams_types::activity::{
|
pub use activitystreams_types::activity::{
|
||||||
kind, properties, AMove, Accept, ActivityExt, Add, Announce, Arrive, Block, Create, Delete,
|
kind, properties, AMove, Accept, Add, Announce, Arrive, Block, Create, Delete, Dislike, Flag,
|
||||||
Dislike, Flag, Follow, Ignore, Invite, Join, Leave, Like, Listen, Offer, Question, Read,
|
Follow, Ignore, Invite, Join, Leave, Like, Listen, Offer, Question, Read, Reject, Remove,
|
||||||
Reject, Remove, TentativeAccept, TentativeReject, Travel, Undo, Update, View,
|
TentativeAccept, TentativeReject, Travel, Undo, Update, View,
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,6 +21,6 @@
|
||||||
|
|
||||||
pub use activitystreams_traits::{Collection, CollectionPage};
|
pub use activitystreams_traits::{Collection, CollectionPage};
|
||||||
pub use activitystreams_types::collection::{
|
pub use activitystreams_types::collection::{
|
||||||
kind, properties, CollectionExt, CollectionPageExt, OrderedCollection, OrderedCollectionPage,
|
kind, properties, OrderedCollection, OrderedCollectionPage, UnorderedCollection,
|
||||||
UnorderedCollection, UnorderedCollectionPage,
|
UnorderedCollectionPage,
|
||||||
};
|
};
|
||||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -99,7 +99,6 @@
|
||||||
//! Mention,
|
//! Mention,
|
||||||
//! },
|
//! },
|
||||||
//! Link,
|
//! Link,
|
||||||
//! LinkExt,
|
|
||||||
//! PropRefs,
|
//! PropRefs,
|
||||||
//! UnitString,
|
//! UnitString,
|
||||||
//! };
|
//! };
|
||||||
|
@ -146,7 +145,7 @@
|
||||||
//! #[activitystreams(None)]
|
//! #[activitystreams(None)]
|
||||||
//! pub my_properties: MyProperties,
|
//! pub my_properties: MyProperties,
|
||||||
//!
|
//!
|
||||||
//! /// Derive AsRef/AsMut/Link/LinkExt for My -> MyProperties
|
//! /// Derive AsRef/AsMut/Link for My -> MyProperties
|
||||||
//! #[activitystreams(Link)]
|
//! #[activitystreams(Link)]
|
||||||
//! pub link_properties: LinkProperties,
|
//! pub link_properties: LinkProperties,
|
||||||
//! }
|
//! }
|
||||||
|
@ -172,11 +171,11 @@ pub mod link;
|
||||||
pub mod object;
|
pub mod object;
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
activity::{Activity, ActivityExt, IntransitiveActivity},
|
activity::{Activity, IntransitiveActivity},
|
||||||
actor::Actor,
|
actor::Actor,
|
||||||
collection::{Collection, CollectionExt, CollectionPage, CollectionPageExt},
|
collection::{Collection, CollectionPage},
|
||||||
link::{Link, LinkExt},
|
link::Link,
|
||||||
object::{Object, ObjectExt},
|
object::Object,
|
||||||
};
|
};
|
||||||
pub use activitystreams_types::{context, primitives};
|
pub use activitystreams_types::{context, primitives};
|
||||||
|
|
||||||
|
|
|
@ -20,4 +20,4 @@
|
||||||
//! Link traits and types
|
//! Link traits and types
|
||||||
|
|
||||||
pub use activitystreams_traits::Link;
|
pub use activitystreams_traits::Link;
|
||||||
pub use activitystreams_types::link::{kind, properties, LinkExt, Mention};
|
pub use activitystreams_types::link::{kind, properties, Mention};
|
||||||
|
|
|
@ -21,6 +21,6 @@
|
||||||
|
|
||||||
pub use activitystreams_traits::Object;
|
pub use activitystreams_traits::Object;
|
||||||
pub use activitystreams_types::object::{
|
pub use activitystreams_types::object::{
|
||||||
kind, properties, Article, Audio, Document, Event, Image, Note, ObjectExt, Page, Place,
|
kind, properties, Article, Audio, Document, Event, Image, Note, Page, Place, Profile,
|
||||||
Profile, Relationship, Tombstone, Video,
|
Relationship, Tombstone, Video,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue