diff --git a/activitystreams-types/src/activity/mod.rs b/activitystreams-types/src/activity/mod.rs index 212d4b6..239d5ab 100644 --- a/activitystreams-types/src/activity/mod.rs +++ b/activitystreams-types/src/activity/mod.rs @@ -31,12 +31,12 @@ mod follow; mod ignore; mod invite; mod join; -mod kind; +pub mod kind; mod leave; mod like; mod listen; mod offer; -mod properties; +pub mod properties; mod question; mod read; mod reject; @@ -47,6 +47,7 @@ mod travel; mod undo; mod update; mod view; + pub use self::accept::*; pub use self::add::*; pub use self::amove::*; @@ -61,12 +62,10 @@ pub use self::follow::*; pub use self::ignore::*; pub use self::invite::*; pub use self::join::*; -pub use self::kind::*; pub use self::leave::*; pub use self::like::*; pub use self::listen::*; pub use self::offer::*; -pub use self::properties::*; pub use self::question::*; pub use self::read::*; pub use self::reject::*; diff --git a/activitystreams-types/src/activity/properties.rs b/activitystreams-types/src/activity/properties.rs index 41fc3a7..fdfd5ce 100644 --- a/activitystreams-types/src/activity/properties.rs +++ b/activitystreams-types/src/activity/properties.rs @@ -17,6 +17,45 @@ * along with ActivityStreams Types. If not, see . */ +//! Namespace for properties of standard Activity types +//! +//! To use these properties in your own types, you can flatten them into your struct with serde: +//! +//! ```rust +//! extern crate activitystreams_traits; +//! extern crate activitystreams_types; +//! extern crate serde; +//! #[macro_use] +//! extern crate serde_derive; +//! +//! use activitystreams_traits::{Activity, Object}; +//! use activitystreams_types::{ +//! activity::properties::ActivityProperties, +//! object::properties::ObjectProperties, +//! }; +//! +//! #[derive(Clone, Debug, Serialize, Deserialize)] +//! #[serde(rename_all = "camelCase")] +//! pub struct MyActivity { +//! #[serde(rename = "type")] +//! pub kind: String, +//! +//! /// Define a require property for the MyActivity type +//! pub my_property: String, +//! +//! #[serde(flatten)] +//! pub object_properties: ObjectProperties, +//! +//! #[serde(flatten)] +//! pub activity_properties: ActivityProperties, +//! } +//! +//! impl Object for MyActivity {} +//! impl Activity for MyActivity {} +//! # +//! # fn main() {} +//! ``` + use activitystreams_traits::{Link, Object}; use serde_json; diff --git a/activitystreams-types/src/collection/properties.rs b/activitystreams-types/src/collection/properties.rs index 65de1d4..f5bb135 100644 --- a/activitystreams-types/src/collection/properties.rs +++ b/activitystreams-types/src/collection/properties.rs @@ -17,23 +17,23 @@ * along with ActivityStreams Types. If not, see . */ -//! Namespace for properties of standard object types +//! Namespace for properties of standard collection types //! //! To use these properties in your own types, you can flatten them into your struct with serde: //! //! ```rust -//! # extern crate activitystreams; -//! # extern crate serde; -//! # #[macro_use] -//! # extern crate serde_derive; -//! # -//! # use activitystreams::{ -//! # collection::properties::CollectionProperties, -//! # object::properties::ObjectProperties, -//! # Collection, -//! # Object -//! # }; -//! # +//! extern crate activitystreams_traits; +//! extern crate activitystreams_types; +//! extern crate serde; +//! #[macro_use] +//! extern crate serde_derive; +//! +//! use activitystreams_traits::{Collection, Object}; +//! use activitystreams_types::{ +//! collection::properties::CollectionProperties, +//! object::properties::ObjectProperties, +//! }; +//! //! #[derive(Clone, Debug, Serialize, Deserialize)] //! #[serde(rename_all = "camelCase")] //! pub struct MyCollection { diff --git a/activitystreams-types/src/custom_props.rs b/activitystreams-types/src/custom_props.rs index cec344a..b7a9986 100644 --- a/activitystreams-types/src/custom_props.rs +++ b/activitystreams-types/src/custom_props.rs @@ -32,8 +32,8 @@ use activitystreams_traits::{ /// /// ## Example /// ```rust -/// use activitystreams::{ -/// custom_props::CustomLink, +/// use activitystreams_types::{ +/// CustomLink, /// link::Mention, /// }; /// @@ -79,8 +79,8 @@ where /// /// ## Example /// ```rust -/// use activitystreams::{ -/// custom_props::CustomObject, +/// use activitystreams_types::{ +/// CustomObject, /// object::Video, /// }; /// diff --git a/activitystreams-types/src/link/properties.rs b/activitystreams-types/src/link/properties.rs index a7102f4..e37b49b 100644 --- a/activitystreams-types/src/link/properties.rs +++ b/activitystreams-types/src/link/properties.rs @@ -22,13 +22,15 @@ //! To use these properties in your own types, you can flatten them into your struct with serde: //! //! ```rust -//! # extern crate activitystreams; -//! # extern crate serde; -//! # #[macro_use] -//! # extern crate serde_derive; -//! # -//! # use activitystreams::{link::properties::LinkProperties, Link}; -//! # +//! extern crate activitystreams_traits; +//! extern crate activitystreams_types; +//! extern crate serde; +//! #[macro_use] +//! extern crate serde_derive; +//! +//! use activitystreams_traits::Link; +//! use activitystreams_types::link::properties::LinkProperties; +//! //! #[derive(Clone, Debug, Serialize, Deserialize)] //! #[serde(rename_all = "camelCase")] //! pub struct MyLink { diff --git a/activitystreams-types/src/object/properties.rs b/activitystreams-types/src/object/properties.rs index 711cec2..a08df67 100644 --- a/activitystreams-types/src/object/properties.rs +++ b/activitystreams-types/src/object/properties.rs @@ -22,13 +22,15 @@ //! To use these properties in your own types, you can flatten them into your struct with serde: //! //! ```rust -//! # extern crate activitystreams; -//! # extern crate serde; -//! # #[macro_use] -//! # extern crate serde_derive; -//! # -//! # use activitystreams::{object::properties::ObjectProperties, Object}; -//! # +//! extern crate activitystreams_traits; +//! extern crate activitystreams_types; +//! extern crate serde; +//! #[macro_use] +//! extern crate serde_derive; +//! +//! use activitystreams_traits::Object; +//! use activitystreams_types::object::properties::ObjectProperties; +//! //! #[derive(Clone, Debug, Serialize, Deserialize)] //! #[serde(rename_all = "camelCase")] //! pub struct MyObject {