mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2024-11-22 03:40:59 +00:00
Fix types tests
This commit is contained in:
parent
6bb22797be
commit
fb17382781
6 changed files with 77 additions and 35 deletions
|
@ -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::*;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
/// };
|
||||
///
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue