Fix types tests

This commit is contained in:
asonix 2018-05-13 23:40:14 -05:00
parent 6bb22797be
commit fb17382781
6 changed files with 77 additions and 35 deletions

View file

@ -31,12 +31,12 @@ mod follow;
mod ignore; mod ignore;
mod invite; mod invite;
mod join; mod join;
mod kind; pub mod kind;
mod leave; mod leave;
mod like; mod like;
mod listen; mod listen;
mod offer; mod offer;
mod properties; pub mod properties;
mod question; mod question;
mod read; mod read;
mod reject; mod reject;
@ -47,6 +47,7 @@ mod travel;
mod undo; mod undo;
mod update; mod update;
mod view; mod view;
pub use self::accept::*; pub use self::accept::*;
pub use self::add::*; pub use self::add::*;
pub use self::amove::*; pub use self::amove::*;
@ -61,12 +62,10 @@ pub use self::follow::*;
pub use self::ignore::*; pub use self::ignore::*;
pub use self::invite::*; pub use self::invite::*;
pub use self::join::*; pub use self::join::*;
pub use self::kind::*;
pub use self::leave::*; pub use self::leave::*;
pub use self::like::*; pub use self::like::*;
pub use self::listen::*; pub use self::listen::*;
pub use self::offer::*; pub use self::offer::*;
pub use self::properties::*;
pub use self::question::*; pub use self::question::*;
pub use self::read::*; pub use self::read::*;
pub use self::reject::*; pub use self::reject::*;

View file

@ -17,6 +17,45 @@
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>. * along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/ */
//! 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 activitystreams_traits::{Link, Object};
use serde_json; use serde_json;

View file

@ -17,23 +17,23 @@
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>. * along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/ */
//! 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: //! To use these properties in your own types, you can flatten them into your struct with serde:
//! //!
//! ```rust //! ```rust
//! # extern crate activitystreams; //! extern crate activitystreams_traits;
//! # extern crate serde; //! extern crate activitystreams_types;
//! # #[macro_use] //! extern crate serde;
//! # extern crate serde_derive; //! #[macro_use]
//! # //! extern crate serde_derive;
//! # use activitystreams::{ //!
//! # collection::properties::CollectionProperties, //! use activitystreams_traits::{Collection, Object};
//! # object::properties::ObjectProperties, //! use activitystreams_types::{
//! # Collection, //! collection::properties::CollectionProperties,
//! # Object //! object::properties::ObjectProperties,
//! # }; //! };
//! # //!
//! #[derive(Clone, Debug, Serialize, Deserialize)] //! #[derive(Clone, Debug, Serialize, Deserialize)]
//! #[serde(rename_all = "camelCase")] //! #[serde(rename_all = "camelCase")]
//! pub struct MyCollection { //! pub struct MyCollection {

View file

@ -32,8 +32,8 @@ use activitystreams_traits::{
/// ///
/// ## Example /// ## Example
/// ```rust /// ```rust
/// use activitystreams::{ /// use activitystreams_types::{
/// custom_props::CustomLink, /// CustomLink,
/// link::Mention, /// link::Mention,
/// }; /// };
/// ///
@ -79,8 +79,8 @@ where
/// ///
/// ## Example /// ## Example
/// ```rust /// ```rust
/// use activitystreams::{ /// use activitystreams_types::{
/// custom_props::CustomObject, /// CustomObject,
/// object::Video, /// object::Video,
/// }; /// };
/// ///

View file

@ -22,13 +22,15 @@
//! To use these properties in your own types, you can flatten them into your struct with serde: //! To use these properties in your own types, you can flatten them into your struct with serde:
//! //!
//! ```rust //! ```rust
//! # extern crate activitystreams; //! extern crate activitystreams_traits;
//! # extern crate serde; //! extern crate activitystreams_types;
//! # #[macro_use] //! extern crate serde;
//! # extern crate serde_derive; //! #[macro_use]
//! # //! extern crate serde_derive;
//! # use activitystreams::{link::properties::LinkProperties, Link}; //!
//! # //! use activitystreams_traits::Link;
//! use activitystreams_types::link::properties::LinkProperties;
//!
//! #[derive(Clone, Debug, Serialize, Deserialize)] //! #[derive(Clone, Debug, Serialize, Deserialize)]
//! #[serde(rename_all = "camelCase")] //! #[serde(rename_all = "camelCase")]
//! pub struct MyLink { //! pub struct MyLink {

View file

@ -22,13 +22,15 @@
//! To use these properties in your own types, you can flatten them into your struct with serde: //! To use these properties in your own types, you can flatten them into your struct with serde:
//! //!
//! ```rust //! ```rust
//! # extern crate activitystreams; //! extern crate activitystreams_traits;
//! # extern crate serde; //! extern crate activitystreams_types;
//! # #[macro_use] //! extern crate serde;
//! # extern crate serde_derive; //! #[macro_use]
//! # //! extern crate serde_derive;
//! # use activitystreams::{object::properties::ObjectProperties, Object}; //!
//! # //! use activitystreams_traits::Object;
//! use activitystreams_types::object::properties::ObjectProperties;
//!
//! #[derive(Clone, Debug, Serialize, Deserialize)] //! #[derive(Clone, Debug, Serialize, Deserialize)]
//! #[serde(rename_all = "camelCase")] //! #[serde(rename_all = "camelCase")]
//! pub struct MyObject { //! pub struct MyObject {