Move Extension traits out of properties modules

This commit is contained in:
asonix 2018-08-03 22:43:01 -05:00
parent 16d06bf550
commit ef7ebb8db2
41 changed files with 124 additions and 101 deletions

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::AcceptType,
properties::{AcceptProperties, ActivityExt, ActivityProperties},
properties::{AcceptProperties, ActivityProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor accepts the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::AddType,
properties::{ActivityExt, ActivityProperties, AddProperties},
properties::{ActivityProperties, AddProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor has added the object to the target.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::MoveType,
properties::{ActivityExt, ActivityProperties, MoveProperties},
properties::{ActivityProperties, MoveProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor has moved object from origin to target.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::AnnounceType,
properties::{ActivityExt, ActivityProperties, AnnounceProperties},
properties::{ActivityProperties, AnnounceProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor is calling the target's attention the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, IntransitiveActivity, Object};
use super::{
kind::ArriveType,
properties::{ActivityExt, ActivityProperties, ArriveProperties},
properties::{ActivityProperties, ArriveProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// An IntransitiveActivity that indicates that the actor has arrived at the location.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::BlockType,
properties::{ActivityExt, ActivityProperties, BlockProperties},
properties::{ActivityProperties, BlockProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor is blocking the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::CreateType,
properties::{ActivityExt, ActivityProperties, CreateProperties},
properties::{ActivityProperties, CreateProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor has created the object.
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::DeleteType,
properties::{ActivityExt, ActivityProperties, DeleteProperties},
properties::{ActivityProperties, DeleteProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor has deleted the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::DislikeType,
properties::{ActivityExt, ActivityProperties, DislikeProperties},
properties::{ActivityProperties, DislikeProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor dislikes the object.
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::FlagType,
properties::{ActivityExt, ActivityProperties, FlagProperties},
properties::{ActivityProperties, FlagProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor is "flagging" the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::FollowType,
properties::{ActivityExt, ActivityProperties, FollowProperties},
properties::{ActivityProperties, FollowProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor is "following" the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::IgnoreType,
properties::{ActivityExt, ActivityProperties, IgnoreProperties},
properties::{ActivityProperties, IgnoreProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor is ignoring the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::InviteType,
properties::{ActivityExt, ActivityProperties, InviteProperties},
properties::{ActivityProperties, InviteProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// A specialization of Offer in which the actor is extending an invitation for the object to the
/// target.

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::JoinType,
properties::{ActivityExt, ActivityProperties, JoinProperties},
properties::{ActivityProperties, JoinProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor has joined the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::LeaveType,
properties::{ActivityExt, ActivityProperties, LeaveProperties},
properties::{ActivityProperties, LeaveProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor has left the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::LikeType,
properties::{ActivityExt, ActivityProperties, LikeProperties},
properties::{ActivityProperties, LikeProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor likes, recommends or endorses the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::ListenType,
properties::{ActivityExt, ActivityProperties, ListenProperties},
properties::{ActivityProperties, ListenProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor has listened to the object.
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]

View file

@ -76,3 +76,12 @@ pub use self::travel::*;
pub use self::undo::*;
pub use self::update::*;
pub use self::view::*;
use activitystreams_traits::Activity;
use self::properties::ActivityProperties;
pub trait ActivityExt: Activity {
fn props(&self) -> &ActivityProperties;
fn props_mut(&mut self) -> &mut ActivityProperties;
}

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::OfferType,
properties::{ActivityExt, ActivityProperties, OfferProperties},
properties::{ActivityProperties, OfferProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor is offering the object.
///

View file

@ -56,14 +56,9 @@
//! # fn main() {}
//! ```
use activitystreams_traits::{Activity, Link, Object};
use activitystreams_traits::{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.

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, IntransitiveActivity, Object};
use super::{
kind::QuestionType,
properties::{ActivityExt, ActivityProperties, QuestionProperties},
properties::{ActivityProperties, QuestionProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Represents a question being asked.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::ReadType,
properties::{ActivityExt, ActivityProperties, ReadProperties},
properties::{ActivityProperties, ReadProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor has read the object.
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::RejectType,
properties::{ActivityExt, ActivityProperties, RejectProperties},
properties::{ActivityProperties, RejectProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor is rejecting the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::RemoveType,
properties::{ActivityExt, ActivityProperties, RemoveProperties},
properties::{ActivityProperties, RemoveProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor is removing the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::TentativeAcceptType,
properties::{ActivityExt, ActivityProperties, TentativeAcceptProperties},
properties::{ActivityProperties, TentativeAcceptProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// A specialization of Accept indicating that the acceptance is tentative.
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::TentativeRejectType,
properties::{ActivityExt, ActivityProperties, TentativeRejectProperties},
properties::{ActivityProperties, TentativeRejectProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// A specialization of Reject in which the rejection is considered tentative.
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, IntransitiveActivity, Object};
use super::{
kind::TravelType,
properties::{ActivityExt, ActivityProperties, TravelProperties},
properties::{ActivityProperties, TravelProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor is traveling to target from origin.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::UndoType,
properties::{ActivityExt, ActivityProperties, UndoProperties},
properties::{ActivityProperties, UndoProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor is undoing the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::UpdateType,
properties::{ActivityExt, ActivityProperties, UpdateProperties},
properties::{ActivityProperties, UpdateProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor has updated the object.
///

View file

@ -21,9 +21,10 @@ use activitystreams_traits::{Activity, Object};
use super::{
kind::ViewType,
properties::{ActivityExt, ActivityProperties, ViewProperties},
properties::{ActivityProperties, ViewProperties},
ActivityExt,
};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
/// Indicates that the actor has viewed the object.
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]

View file

@ -21,7 +21,7 @@
use activitystreams_traits::{Actor, Object};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
pub mod kind;
use self::kind::*;

View file

@ -21,13 +21,23 @@
use activitystreams_traits::{Collection, CollectionPage, Object};
use object::properties::{ObjectExt, ObjectProperties};
use object::{properties::ObjectProperties, ObjectExt};
pub mod kind;
pub mod properties;
use self::kind::*;
use self::properties::*;
pub trait CollectionExt: Collection {
fn props(&self) -> &CollectionProperties;
fn props_mut(&mut self) -> &mut CollectionProperties;
}
pub trait CollectionPageExt: CollectionPage {
fn props(&self) -> &CollectionPageProperties;
fn props_mut(&mut self) -> &mut CollectionPageProperties;
}
/// The default `Collection` type.
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -59,16 +59,6 @@
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`.
///

View file

@ -26,6 +26,11 @@ pub mod properties;
use self::kind::*;
use self::properties::*;
pub trait LinkExt: Link {
fn props(&self) -> &LinkProperties;
fn props_mut(&mut self) -> &mut LinkProperties;
}
/// A specialized Link that represents an @mention.
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]

View file

@ -53,11 +53,6 @@ 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.
///

View file

@ -26,6 +26,11 @@ pub mod properties;
use self::kind::*;
use self::properties::*;
pub trait ObjectExt: Object {
fn props(&self) -> &ObjectProperties;
fn props_mut(&mut self) -> &mut ObjectProperties;
}
/// Represents any kind of multi-paragraph written work.
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]

View file

@ -56,11 +56,6 @@ 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>;

View file

@ -21,9 +21,7 @@
pub use activitystreams_traits::{Activity, IntransitiveActivity};
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,
kind, properties, AMove, Accept, ActivityExt, 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,
};

View file

@ -21,7 +21,6 @@
pub use activitystreams_traits::{Collection, CollectionPage};
pub use activitystreams_types::collection::{
kind,
properties::{self, CollectionExt, CollectionPageExt},
OrderedCollection, OrderedCollectionPage, UnorderedCollection, UnorderedCollectionPage,
kind, properties, CollectionExt, CollectionPageExt, OrderedCollection, OrderedCollectionPage,
UnorderedCollection, UnorderedCollectionPage,
};

View file

@ -20,8 +20,4 @@
//! Link traits and types
pub use activitystreams_traits::Link;
pub use activitystreams_types::link::{
kind,
properties::{self, LinkExt},
Mention,
};
pub use activitystreams_types::link::{kind, properties, LinkExt, Mention};

View file

@ -21,8 +21,6 @@
pub use activitystreams_traits::Object;
pub use activitystreams_types::object::{
kind,
properties::{self, ObjectExt},
Article, Audio, Document, Event, Image, Note, Page, Place, Profile, Relationship, Tombstone,
Video,
kind, properties, Article, Audio, Document, Event, Image, Note, ObjectExt, Page, Place,
Profile, Relationship, Tombstone, Video,
};