diff --git a/examples/basic.rs b/examples/basic.rs index 819e2b6..310fe60 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -1,4 +1,4 @@ -use activitystreams::object::streams::Video; +use activitystreams::object::Video; fn main() -> Result<(), Box> { let mut v = Video::default(); diff --git a/examples/de.rs b/examples/de.rs index 74293b1..b3df608 100644 --- a/examples/de.rs +++ b/examples/de.rs @@ -1,6 +1,6 @@ use activitystreams::{ - collection::{apub::OrderedCollection, properties::CollectionProperties}, - object::{streams::Page, ObjectBox}, + collection::{properties::CollectionProperties, OrderedCollection}, + object::{ObjectBox, Page}, }; use anyhow::Error; diff --git a/src/activity/mod.rs b/src/activity/mod.rs index b77ee51..838a7e1 100644 --- a/src/activity/mod.rs +++ b/src/activity/mod.rs @@ -17,6 +17,8 @@ * along with ActivityStreams. If not, see . */ +//! Namespace for Activity types + #[cfg(feature = "kinds")] pub mod kind; #[cfg(feature = "types")] diff --git a/src/activity/properties.rs b/src/activity/properties.rs index 7bcbce3..5523b6c 100644 --- a/src/activity/properties.rs +++ b/src/activity/properties.rs @@ -26,6 +26,7 @@ //! properties::ActivityProperties, //! Activity, ActivityBox, //! }, +//! ext::Ext, //! object::{ //! properties::ObjectProperties, //! Object, ObjectBox, @@ -34,7 +35,15 @@ //! }; //! use serde::{Deserialize, Serialize}; //! -//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)] +//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +//! #[serde(transparent)] +//! pub struct ObjProps(pub ObjectProperties); +//! +//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +//! #[serde(transparent)] +//! pub struct ActivityProps(pub ActivityProperties); +//! +//! #[derive(Clone, Debug, Default, Serialize, Deserialize, PropRefs)] //! #[serde(rename_all = "camelCase")] //! #[prop_refs(Object)] //! #[prop_refs(Activity)] @@ -49,11 +58,11 @@ //! //! #[serde(flatten)] //! #[prop_refs] -//! pub object_properties: ObjectProperties, +//! pub object_properties: ObjProps, //! //! #[serde(flatten)] //! #[prop_refs] -//! pub activity_properties: ActivityProperties, +//! pub activity_properties: ActivityProps, //! } //! # //! # fn main() {} diff --git a/src/actor/properties.rs b/src/actor/properties.rs index 351faa1..2a4b329 100644 --- a/src/actor/properties.rs +++ b/src/actor/properties.rs @@ -27,15 +27,28 @@ //! properties::ApActorProperties, //! Actor, ActorBox, //! }, +//! ext::Ext, //! object::{ //! properties::{ApObjectProperties, ObjectProperties}, //! Object, ObjectBox, //! }, -//! PropRefs, +//! Base, BaseBox, PropRefs, //! }; //! use serde::{Deserialize, Serialize}; //! -//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)] +//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +//! #[serde(transparent)] +//! pub struct ObjProps(pub ObjectProperties); +//! +//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +//! #[serde(transparent)] +//! pub struct ApObjProps(pub ApObjectProperties); +//! +//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +//! #[serde(transparent)] +//! pub struct ApActorProps(pub ApActorProperties); +//! +//! #[derive(Clone, Debug, Default, Serialize, Deserialize, PropRefs)] //! #[serde(rename_all = "camelCase")] //! #[prop_refs(Object)] //! #[prop_refs(Actor)] @@ -48,15 +61,15 @@ //! //! #[serde(flatten)] //! #[prop_refs] -//! pub object_props: ObjectProperties, +//! pub object_props: ObjProps, //! //! #[serde(flatten)] //! #[prop_refs] -//! pub ap_object_props: ApObjectProperties, +//! pub ap_object_props: ApObjProps, //! //! #[serde(flatten)] //! #[prop_refs] -//! pub actor_props: ApActorProperties, +//! pub actor_props: ApActorProps, //! } //! # //! # fn main() {} diff --git a/src/collection/mod.rs b/src/collection/mod.rs index 41bad26..6236f52 100644 --- a/src/collection/mod.rs +++ b/src/collection/mod.rs @@ -26,7 +26,7 @@ pub mod properties; #[cfg(feature = "types")] mod types; -#[cfg(features = "types")] +#[cfg(feature = "types")] pub use self::types::{ OrderedCollection, OrderedCollectionPage, UnorderedCollection, UnorderedCollectionPage, }; diff --git a/src/collection/properties.rs b/src/collection/properties.rs index 1a27fe1..8fb2acf 100644 --- a/src/collection/properties.rs +++ b/src/collection/properties.rs @@ -27,15 +27,24 @@ //! properties::CollectionProperties, //! Collection, CollectionBox, //! }, +//! ext::Ext, //! object::{ //! properties::ObjectProperties, //! Object, ObjectBox, //! }, -//! PropRefs, +//! Base, BaseBox, PropRefs, //! }; //! use serde::{Deserialize, Serialize}; //! -//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)] +//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +//! #[serde(transparent)] +//! pub struct ObjProps(pub ObjectProperties); +//! +//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +//! #[serde(transparent)] +//! pub struct CollectionProps(pub CollectionProperties); +//! +//! #[derive(Clone, Debug, Default, Serialize, Deserialize, PropRefs)] //! #[serde(rename_all = "camelCase")] //! #[prop_refs(Object)] //! #[prop_refs(Collection)] @@ -48,11 +57,11 @@ //! //! #[serde(flatten)] //! #[prop_refs] -//! pub object_properties: ObjectProperties, +//! pub object_properties: ObjProps, //! //! #[serde(flatten)] //! #[prop_refs] -//! pub collection_properties: CollectionProperties, +//! pub collection_properties: CollectionProps, //! } //! # //! # fn main() {} diff --git a/src/lib.rs b/src/lib.rs index 562e023..8c67052 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -267,6 +267,8 @@ //! ```rust //! use activitystreams::{ //! context, +//! actor::{Actor, ActorBox}, +//! ext::Ext, //! object::{ //! properties::{ //! ObjectProperties, @@ -276,9 +278,8 @@ //! Object, //! ObjectBox, //! }, -//! actor::{Actor, ActorBox}, //! primitives::XsdAnyUri, -//! PropRefs, +//! Base, BaseBox, PropRefs, //! }; //! use serde::{Deserialize, Serialize}; //! @@ -320,11 +321,12 @@ //! ```rust //! use activitystreams::{ //! properties, +//! ext::Ext, //! link::{ //! properties::LinkProperties, //! Link, LinkBox, Mention, //! }, -//! PropRefs, +//! Base, BaseBox, PropRefs, //! UnitString, //! }; //! use serde::{Deserialize, Serialize}; @@ -357,6 +359,10 @@ //! } //! } //! +//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +//! #[serde(transparent)] +//! pub struct MyLinkProps(pub LinkProperties); +//! //! /// Using the Properties derive macro //! /// //! /// This macro generates getters and setters for the associated fields. @@ -371,9 +377,9 @@ //! #[prop_refs] //! pub my_properties: MyProperties, //! -//! /// Derive AsRef/AsMut/Link for My -> LinkProperties +//! /// Derive AsRef/AsMut/Link for My -> MyLinkProperties //! #[prop_refs] -//! pub link_properties: LinkProperties, +//! pub link_properties: MyLinkProps, //! } //! //! fn main() -> Result<(), anyhow::Error> { diff --git a/src/link/properties.rs b/src/link/properties.rs index bef2715..67b9d9c 100644 --- a/src/link/properties.rs +++ b/src/link/properties.rs @@ -23,15 +23,20 @@ //! //! ```rust //! use activitystreams::{ +//! ext::Ext, //! link::{ //! properties::LinkProperties, //! Link, LinkBox, //! }, -//! PropRefs, +//! Base, BaseBox, PropRefs, //! }; //! use serde::{Deserialize, Serialize}; //! -//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)] +//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +//! #[serde(transparent)] +//! pub struct MyProps(pub LinkProperties); +//! +//! #[derive(Clone, Debug, Default, Serialize, Deserialize, PropRefs)] //! #[serde(rename_all = "camelCase")] //! #[prop_refs(Link)] //! pub struct MyLink { @@ -43,7 +48,7 @@ //! //! #[serde(flatten)] //! #[prop_refs] -//! pub link_properties: LinkProperties, +//! pub link_properties: MyProps, //! } //! # //! # fn main() {} diff --git a/src/object/properties.rs b/src/object/properties.rs index df4c7c3..d287f8e 100644 --- a/src/object/properties.rs +++ b/src/object/properties.rs @@ -23,15 +23,20 @@ //! //! ```rust //! use activitystreams::{ +//! ext::Ext, //! object::{ //! properties::ObjectProperties, //! Object, ObjectBox, //! }, //! Base, BaseBox, PropRefs, //! }; -//! use serde::{Deserialize, Serialize}; +//! use std::collections::HashMap; //! -//! #[derive(Clone, Debug, Serialize, Deserialize, PropRefs)] +//! #[derive(Clone, Debug, Default, serde::Serialize, serde::Deserialize)] +//! #[serde(transparent)] +//! pub struct MyProps(pub ObjectProperties); +//! +//! #[derive(Clone, Debug, Default, PropRefs, serde::Serialize, serde::Deserialize)] //! #[serde(rename_all = "camelCase")] //! #[prop_refs(Object)] //! pub struct MyObject { @@ -43,7 +48,7 @@ //! //! #[serde(flatten)] //! #[prop_refs] -//! pub object_properties: ObjectProperties, +//! pub extra: MyProps, //! } //! # //! # fn main() {}