use activitystreams_traits::{Collection, CollectionPage, Object};
use object::{properties::ObjectProperties, ObjectExt};
pub mod kind;
pub mod properties;
use self::kind::*;
use self::properties::*;
pub trait CollectionExt: Collection {
fn props(&self) -> &CollectionProperties;
fn props_mut(&mut self) -> &mut CollectionProperties;
}
pub trait CollectionPageExt: CollectionPage {
fn props(&self) -> &CollectionPageProperties;
fn props_mut(&mut self) -> &mut CollectionPageProperties;
}
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]
pub struct UnorderedCollection {
#[serde(rename = "type")]
kind: CollectionType,
#[serde(flatten)]
pub object_props: ObjectProperties,
#[serde(flatten)]
pub collection_props: CollectionProperties,
}
impl Object for UnorderedCollection {}
impl ObjectExt for UnorderedCollection {
fn props(&self) -> &ObjectProperties {
&self.object_props
}
fn props_mut(&mut self) -> &mut ObjectProperties {
&mut self.object_props
}
}
impl Collection for UnorderedCollection {}
impl CollectionExt for UnorderedCollection {
fn props(&self) -> &CollectionProperties {
&self.collection_props
}
fn props_mut(&mut self) -> &mut CollectionProperties {
&mut self.collection_props
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]
pub struct OrderedCollection {
#[serde(rename = "type")]
kind: OrderedCollectionType,
#[serde(flatten)]
pub object_props: ObjectProperties,
#[serde(flatten)]
pub collection_props: CollectionProperties,
}
impl Object for OrderedCollection {}
impl ObjectExt for OrderedCollection {
fn props(&self) -> &ObjectProperties {
&self.object_props
}
fn props_mut(&mut self) -> &mut ObjectProperties {
&mut self.object_props
}
}
impl Collection for OrderedCollection {}
impl CollectionExt for OrderedCollection {
fn props(&self) -> &CollectionProperties {
&self.collection_props
}
fn props_mut(&mut self) -> &mut CollectionProperties {
&mut self.collection_props
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]
pub struct UnorderedCollectionPage {
#[serde(rename = "type")]
kind: CollectionPageType,
#[serde(flatten)]
pub object_props: ObjectProperties,
#[serde(flatten)]
pub collection_props: CollectionProperties,
#[serde(flatten)]
pub collection_page_props: CollectionPageProperties,
}
impl Object for UnorderedCollectionPage {}
impl ObjectExt for UnorderedCollectionPage {
fn props(&self) -> &ObjectProperties {
&self.object_props
}
fn props_mut(&mut self) -> &mut ObjectProperties {
&mut self.object_props
}
}
impl Collection for UnorderedCollectionPage {}
impl CollectionExt for UnorderedCollectionPage {
fn props(&self) -> &CollectionProperties {
&self.collection_props
}
fn props_mut(&mut self) -> &mut CollectionProperties {
&mut self.collection_props
}
}
impl CollectionPage for UnorderedCollectionPage {}
impl CollectionPageExt for UnorderedCollectionPage {
fn props(&self) -> &CollectionPageProperties {
&self.collection_page_props
}
fn props_mut(&mut self) -> &mut CollectionPageProperties {
&mut self.collection_page_props
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]
pub struct OrderedCollectionPage {
#[serde(rename = "type")]
kind: OrderedCollectionPageType,
#[serde(flatten)]
pub object_props: ObjectProperties,
#[serde(flatten)]
pub collection_props: CollectionProperties,
#[serde(flatten)]
pub collection_page_props: CollectionPageProperties,
#[serde(flatten)]
pub ordered_collection_page_props: OrderedCollectionPageProperties,
}
impl Object for OrderedCollectionPage {}
impl ObjectExt for OrderedCollectionPage {
fn props(&self) -> &ObjectProperties {
&self.object_props
}
fn props_mut(&mut self) -> &mut ObjectProperties {
&mut self.object_props
}
}
impl Collection for OrderedCollectionPage {}
impl CollectionExt for OrderedCollectionPage {
fn props(&self) -> &CollectionProperties {
&self.collection_props
}
fn props_mut(&mut self) -> &mut CollectionProperties {
&mut self.collection_props
}
}
impl CollectionPage for OrderedCollectionPage {}
impl CollectionPageExt for OrderedCollectionPage {
fn props(&self) -> &CollectionPageProperties {
&self.collection_page_props
}
fn props_mut(&mut self) -> &mut CollectionPageProperties {
&mut self.collection_page_props
}
}