mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2024-11-25 13:21:00 +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 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::*;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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,
|
||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue