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 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::*;

View file

@ -17,6 +17,45 @@
* 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 serde_json;

View file

@ -17,23 +17,23 @@
* 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:
//!
//! ```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 {

View file

@ -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,
/// };
///

View file

@ -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 {

View file

@ -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 {