Reorganize into workspace

This commit is contained in:
asonix 2018-05-13 22:24:41 -05:00
parent bf4df5f760
commit 176fd0bc8f
68 changed files with 1029 additions and 546 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "activitystreams"
description = "Derive macros for activitystreams"
description = "Activity Streams in Rust"
version = "0.1.0"
license = "GPL-3.0"
authors = ["asonix <asonix.dev@gmail.com>"]
@ -8,10 +8,12 @@ repository = "https://github.com/asonix/activitystreams"
keywords = ["activitystreams", "activitypub"]
[dependencies]
activitystreams-derive = { version = "0.1", path = "activitystreams-derive" }
chrono = { version = "0.4", features = ["serde"] }
failure = "0.1"
mime = "0.3"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
activitystreams-traits = { version = "0.1", path = "activitystreams-traits" }
activitystreams-types = { version = "0.1", path = "activitystreams-types" }
[workspace]
members = [
"activitystreams-derive",
"activitystreams-traits",
"activitystreams-types",
]

View file

@ -224,7 +224,7 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
if is_concrete {
if is_option {
let single = quote! {
let single_1 = quote! {
/// Retrieve a value from the given struct
///
/// This method deserializes the item from JSON, so be wary of using
@ -232,28 +232,33 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
///
/// Possible errors from this method are `Error::NotFound` and
/// `Error::Deserialize`
pub fn #fn_name(&self) -> ::error::Result<#variant> {
::properties::from_item(&self.#ident)
pub fn #fn_name(&self) -> ::activitystreams_traits::Result<#variant> {
::activitystreams_traits::properties::from_item(&self.#ident)
}
};
let single_2 = quote! {
/// Set a value in the given struct
///
/// This method serializes the item to JSON, so be wary of using this a
/// lot.
///
/// Possible errors from this method are `Error::Serialize`
pub fn #set_fn_name(&mut self, item: #variant) -> ::error::Result<()> {
self.#ident = ::properties::to_item(item)?;
pub fn #set_fn_name(&mut self, item: #variant) -> ::activitystreams_traits::Result<()> {
self.#ident = ::activitystreams_traits::properties::to_item(item)?;
Ok(())
}
};
let single = quote! {
#single_1
#single_2
};
if is_functional {
single
} else {
quote! {
#single
let plural_1 = quote! {
/// Retrieve many values from the given struct
///
/// This method deserializes the item from JSON, so be wary of using
@ -261,44 +266,59 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
///
/// Possible errors from this method are `Error::NotFound` and
/// `Error::Deserialize`
pub fn #fn_plural(&self) -> ::error::Result<Vec<#variant>> {
::properties::from_item(&self.#ident)
pub fn #fn_plural(&self) -> ::activitystreams_traits::Result<Vec<#variant>> {
::activitystreams_traits::properties::from_item(&self.#ident)
}
};
let plural_2 = quote! {
/// Set many values in the given struct
///
/// This method serializes the item to JSON, so be wary of using
/// this a lot.
///
/// Possible errors from this method are `Error::Serialize`
pub fn #set_fn_plural(&mut self, item: Vec<#variant>) -> ::error::Result<()> {
self.#ident = ::properties::to_item(item)?;
pub fn #set_fn_plural(&mut self, item: Vec<#variant>) -> ::activitystreams_traits::Result<()> {
self.#ident = ::activitystreams_traits::properties::to_item(item)?;
Ok(())
}
};
quote! {
#single
#plural_1
#plural_2
}
}
} else if is_vec {
quote! {
let single_1 = quote! {
/// Retrieve many values from the given struct
///
/// This method deserializes the item from JSON, so be wary of using
/// this a lot.
///
/// Possible errors from this method are `Error::Deserialize`
pub fn #fn_name(&self) -> ::error::Result<Vec<#variant>> {
::properties::from_vec(&self.#ident)
pub fn #fn_name(&self) -> ::activitystreams_traits::Result<Vec<#variant>> {
::activitystreams_traits::properties::from_vec(&self.#ident)
}
};
let single_2 = quote! {
/// Set many values in the given struct
///
/// This method serializes the item to JSON, so be wary of using
/// this a lot.
///
/// Possible errors from this method are `Error::Serialize`
pub fn #set_fn_name(&mut self, item: Vec<#variant>>) -> ::error::Result<()> {
self.#ident = ::properties::to_vec(item)?;
pub fn #set_fn_name(&mut self, item: Vec<#variant>>) -> ::activitystreams_traits::Result<()> {
self.#ident = ::activitystreams_traits::properties::to_vec(item)?;
Ok(())
}
};
quote! {
#single_1
#single_2
}
} else {
let single = quote! {
@ -308,8 +328,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
/// this a lot.
///
/// Possible errors from this method are `Error::Deserialize`
pub fn #fn_name(&self) -> ::error::Result<#variant> {
::properties::from_value(&self.#ident)
pub fn #fn_name(&self) -> ::activitystreams_traits::Result<#variant> {
::activitystreams_traits::properties::from_value(&self.#ident)
}
/// Set a value in the given struct
@ -318,8 +338,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
/// lot.
///
/// Possible errors from this method are `Error::Serialize`
pub fn #set_fn_name(&mut self, item: #variant) -> ::error::Result<()> {
self.#ident = ::properties::to_value(item)?;
pub fn #set_fn_name(&mut self, item: #variant) -> ::activitystreams_traits::Result<()> {
self.#ident = ::activitystreams_traits::properties::to_value(item)?;
Ok(())
}
};
@ -327,29 +347,35 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
if is_functional {
single
} else {
quote! {
#single
let plural_1 = quote! {
/// Retrieve many values from the given struct
///
/// This method deserializes the item from JSON, so be wary of using
/// this a lot.
///
/// Possible errors from this method are `Error::Deserialize`
pub fn #fn_plural(&self) -> ::error::Result<Vec<#variant>> {
::properties::from_value(&self.#ident)
pub fn #fn_plural(&self) -> ::activitystreams_traits::Result<Vec<#variant>> {
::activitystreams_traits::properties::from_value(&self.#ident)
}
};
let plural_2 = quote! {
/// Set many values in the given struct
///
/// This method serializes the item to JSON, so be wary of using this
/// a lot.
///
/// Possible errors from this method are `Error::Serialize`
pub #set_fn_plural(&mut self, item: Vec<#variant>) -> ::error::Result<()> {
self.#ident = ::properties::to_value(item)?;
pub #set_fn_plural(&mut self, item: Vec<#variant>) -> ::activitystreams_traits::Result<()> {
self.#ident = ::activitystreams_traits::properties::to_value(item)?;
Ok(())
}
};
quote! {
#single
#plural_1
#plural_2
}
}
}
@ -362,8 +388,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
///
/// Possible errors from this method are `Error::NotFound` and
/// `Error::Deserialize`
pub fn #fn_name<T: #variant>(&self) -> ::error::Result<T> {
::properties::from_item(&self.#ident)
pub fn #fn_name<T: #variant>(&self) -> ::activitystreams_traits::Result<T> {
::activitystreams_traits::properties::from_item(&self.#ident)
}
};
@ -374,8 +400,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
/// lot.
///
/// Possible errors from this method are `Error::Serialize`
pub fn #set_fn_name<T: #variant>(&mut self, item: T) -> ::error::Result<()> {
self.#ident = ::properties::to_item(item)?;
pub fn #set_fn_name<T: #variant>(&mut self, item: T) -> ::activitystreams_traits::Result<()> {
self.#ident = ::activitystreams_traits::properties::to_item(item)?;
Ok(())
}
};
@ -396,8 +422,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
///
/// Possible errors from this method are `Error::NotFound` and
/// `Error::Deserialize`
pub fn #fn_plural<T: #variant>(&self) -> ::error::Result<Vec<T>> {
::properties::from_item(&self.#ident)
pub fn #fn_plural<T: #variant>(&self) -> ::activitystreams_traits::Result<Vec<T>> {
::activitystreams_traits::properties::from_item(&self.#ident)
}
};
@ -408,8 +434,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
/// this a lot.
///
/// Possible errors from this method are `Error::Serialize`
pub fn #set_fn_plural<T: #variant>(&mut self, item: Vec<T>) -> ::error::Result<()> {
self.#ident = ::properties::to_item(item)?;
pub fn #set_fn_plural<T: #variant>(&mut self, item: Vec<T>) -> ::activitystreams_traits::Result<()> {
self.#ident = ::activitystreams_traits::properties::to_item(item)?;
Ok(())
}
};
@ -428,8 +454,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
/// this a lot.
///
/// Possible errors from this method are `Error::Deserialize`
pub fn #fn_name<T: #variant>(&self) -> ::error::Result<Vec<T>> {
::properties::from_vec(&self.#ident)
pub fn #fn_name<T: #variant>(&self) -> ::activitystreams_traits::Result<Vec<T>> {
::activitystreams_traits::properties::from_vec(&self.#ident)
}
};
@ -440,8 +466,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
/// this a lot.
///
/// Possible errors from this method are `Error::Serialize`
pub fn #set_fn_name<T: #variant>(&mut self, item: Vec<T>) -> ::error::Result<()> {
self.#ident = ::properties::to_vec(item)?;
pub fn #set_fn_name<T: #variant>(&mut self, item: Vec<T>) -> ::activitystreams_traits::Result<()> {
self.#ident = ::activitystreams_traits::properties::to_vec(item)?;
Ok(())
}
};
@ -458,8 +484,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
/// this a lot.
///
/// Possible errors from this method are `Error::Deserialize`
pub fn #fn_name<T: #variant>(&self) -> ::error::Result<T> {
::properties::from_value(&self.#ident)
pub fn #fn_name<T: #variant>(&self) -> ::activitystreams_traits::Result<T> {
::activitystreams_traits::properties::from_value(&self.#ident)
}
};
@ -470,8 +496,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
/// lot.
///
/// Possible errors from this method are `Error::Serialize`
pub fn #set_fn_name<T: #variant>(&mut self, item: T) -> ::error::Result<()> {
self.#ident = ::properties::to_value(item)?;
pub fn #set_fn_name<T: #variant>(&mut self, item: T) -> ::activitystreams_traits::Result<()> {
self.#ident = ::activitystreams_traits::properties::to_value(item)?;
Ok(())
}
};
@ -491,8 +517,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
/// this a lot.
///
/// Possible errors from this method are `Error::Deserialize`
pub fn #fn_plural<T: #variant>(&self) -> ::error::Result<Vec<T>> {
::properties::from_value(&self.#ident)
pub fn #fn_plural<T: #variant>(&self) -> ::activitystreams_traits::Result<Vec<T>> {
::activitystreams_traits::properties::from_value(&self.#ident)
}
};
@ -503,8 +529,8 @@ pub fn properties_derive(input: TokenStream) -> TokenStream {
/// a lot.
///
/// Possible errors from this method are `Error::Serialize`
pub fn #set_fn_plural<T: #variant>(&mut self, item: Vec<T>) -> ::error::Result<()> {
self.#ident = ::properties::to_value(item)?;
pub fn #set_fn_plural<T: #variant>(&mut self, item: Vec<T>) -> ::activitystreams_traits::Result<()> {
self.#ident = ::activitystreams_traits::properties::to_value(item)?;
Ok(())
}
};

3
activitystreams-traits/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/target
**/*.rs.bk
Cargo.lock

View file

@ -0,0 +1,13 @@
[package]
name = "activitystreams-traits"
description = "Traits for ActivityStreams objects"
version = "0.1.0"
license = "GPL-3.0"
authors = ["asonix <asonix.dev@gmail.com>"]
repository = "https://github.com/asonix/activitystreams"
keywords = ["activitystreams", "activitypub"]
[dependencies]
failure = "0.1"
serde = "1.0"
serde_json = "1.0"

View file

@ -0,0 +1,23 @@
/*
* This file is part of ActivityStreams Traits.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams Traits is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams Traits is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams Traits. If not, see <http://www.gnu.org/licenses/>.
*/
use object::Object;
pub trait Activity: Object {}
pub trait IntransitiveActivity: Activity {}

View file

@ -0,0 +1,41 @@
/*
* This file is part of ActivityStreams Traits.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams Traits is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams Traits is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams Traits. If not, see <http://www.gnu.org/licenses/>.
*/
use object::Object;
/// `Actor` types are `Object` types that are capable of performing activities.
///
/// This specification intentionally defines `Actors` in only the most generalized way, stopping
/// short of defining semantically specific properties for each. All Actor objects are
/// specializations of `Object` and inherit all of the core properties common to all Objects.
/// External vocabularies can be used to express additional detail not covered by the Activity
/// Vocabulary. VCard [[vcard-rdf](https://www.w3.org/TR/vcard-rdf/) SHOULD be used to provide
/// additional metadata for `Person`, `Group`, and `Organization` instances.
///
/// While implementations are free to introduce new types of Actors beyond those defined by the
/// Activity Vocabulary, interoperability issues can arise when applications rely too much on
/// extension types that are not recognized by other implementations. Care should be taken to not
/// unduly overlap with or duplicate the existing `Actor` types.
///
/// When an implementation uses an extension type that overlaps with a core vocabulary type, the
/// implementation MUST also specify the core vocabulary type. For instance, some vocabularies
/// (e.g. VCard) define their own types for describing people. An implementation that wishes, for
/// example, to use a `vcard:Individual` as an `Actor` MUST also identify that `Actor` as a
/// `Person`.
pub trait Actor: Object {}

View file

@ -0,0 +1,27 @@
/*
* This file is part of ActivityStreams Traits.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams Traits is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams Traits is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams Traits. If not, see <http://www.gnu.org/licenses/>.
*/
use object::Object;
/// A Collection is a subtype of `Object` that represents ordered or unordered sets of `Object` or
/// `Link` instances.
pub trait Collection: Object {}
/// Used to represent distinct subsets of items from a Collection.
pub trait CollectionPage: Collection {}

View file

@ -0,0 +1,40 @@
/*
* This file is part of ActivityStreams Traits.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams Traits is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams Traits is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams Traits. If not, see <http://www.gnu.org/licenses/>.
*/
use std::result;
/// The Error type
#[derive(Copy, Clone, Debug, Fail)]
pub enum Error {
/// This error occurs when an Activity Streams type does not contain a requested value
#[fail(display = "Key not present")]
NotFound,
/// This error occurs when a requested value could not be deserialized into the requested type
#[fail(display = "Failed to deserialize data as requested type")]
Deserialize,
/// This error occurs when a provided item could not be serialized into an Activity Streams
/// type
#[fail(display = "Failed to serialize data")]
Serialize,
}
/// An alias for Result<T, Error>
pub type Result<T> = result::Result<T, Error>;

View file

@ -0,0 +1,38 @@
/*
* This file is part of ActivityStreams Traits.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams Traits is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams Traits is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams Traits. If not, see <http://www.gnu.org/licenses/>.
*/
#[macro_use]
extern crate failure;
extern crate serde;
extern crate serde_json;
mod activity;
mod actor;
mod collection;
mod error;
mod link;
mod object;
pub mod properties;
pub use self::activity::*;
pub use self::actor::*;
pub use self::collection::*;
pub use self::error::*;
pub use self::link::*;
pub use self::object::*;

View file

@ -0,0 +1,23 @@
/*
* This file is part of ActivityStreams Traits.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams Traits is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams Traits is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams Traits. If not, see <http://www.gnu.org/licenses/>.
*/
use serde::{de::DeserializeOwned, ser::Serialize};
/// The Link is the secondary base type for the Activity Streams vocabulary.
pub trait Link: DeserializeOwned + Serialize {}

View file

@ -0,0 +1,23 @@
/*
* This file is part of ActivityStreams Traits.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams Traits is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams Traits is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams Traits. If not, see <http://www.gnu.org/licenses/>.
*/
use serde::{de::DeserializeOwned, ser::Serialize};
/// The Object is the primary base type for the Activity Streams vocabulary.
pub trait Object: DeserializeOwned + Serialize {}

View file

@ -0,0 +1,90 @@
/*
* This file is part of ActivityStreams Traits.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams Traits is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams Traits is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams Traits. If not, see <http://www.gnu.org/licenses/>.
*/
//! A module containing helpers for tranlsating common JSON representations to and from concrete
//! types
use serde::{de::DeserializeOwned, ser::Serialize};
use serde_json;
use error::{Error, Result};
/// Deserialize a `Value` into concrete type I
pub fn from_value<I>(item: &serde_json::Value) -> Result<I>
where
I: DeserializeOwned,
{
serde_json::from_value(item.clone()).map_err(|_| Error::Deserialize)
}
/// Serialize concrete type I into a `Value`
pub fn to_value<I>(item: I) -> Result<serde_json::Value>
where
I: Serialize,
{
serde_json::to_value(item).map_err(|_| Error::Serialize)
}
/// Deserialize an `Option<Value>` into concrete type I
pub fn from_item<I>(item: &Option<serde_json::Value>) -> Result<I>
where
I: DeserializeOwned,
{
if let &Some(ref item) = item {
from_value(item)
} else {
Err(Error::NotFound)
}
}
/// Serialize concrete type I into an `Option<Value>`
pub fn to_item<I>(item: I) -> Result<Option<serde_json::Value>>
where
I: Serialize,
{
to_value(item).map(Some)
}
/// Deserialize a `Vec<Value>` into a `Vec<I>`
pub fn from_vec<I>(v: &Vec<serde_json::Value>) -> Result<Vec<I>>
where
I: DeserializeOwned,
{
v.iter().fold(Ok(Vec::new()), |acc, item| match acc {
Ok(mut acc) => from_value(item).map(|item| {
acc.push(item);
acc
}),
e => e,
})
}
/// Serialize a `Vec<I>` into a `Vec<Value>`
pub fn to_vec<I>(v: Vec<I>) -> Result<Vec<serde_json::Value>>
where
I: Serialize,
{
v.into_iter().fold(Ok(Vec::new()), |acc, item| match acc {
Ok(mut acc) => to_value(item).map(|item| {
acc.push(item);
acc
}),
e => e,
})
}

View file

@ -0,0 +1,17 @@
[package]
name = "activitystreams-types"
description = "Base types from the Activity Streams spec"
version = "0.1.0"
license = "GPL-3.0"
authors = ["asonix <asonix.dev@gmail.com>"]
repository = "https://github.com/asonix/activitystreams"
keywords = ["activitystreams", "activitypub"]
[dependencies]
activitystreams-derive = { version = "0.1", path = "../activitystreams-derive" }
activitystreams-traits = { version = "0.1", path = "../activitystreams-traits" }
chrono = { version = "0.4", features = ["serde"] }
mime = "0.3"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::AcceptType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::AcceptType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::AddType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::AddType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::MoveType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::MoveType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::AnnounceType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::AnnounceType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, IntransitiveActivity, Link, Object};
use serde_json;
use super::{kind::ArriveType, properties::ActivityProperties, Activity, IntransitiveActivity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::ArriveType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::BlockType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::BlockType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::CreateType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::CreateType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::DeleteType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::DeleteType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::DislikeType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::DislikeType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::FlagType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::FlagType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::FollowType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::FollowType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::IgnoreType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::IgnoreType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::InviteType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::InviteType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::JoinType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::JoinType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,20 +1,20 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use std::fmt;

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::LeaveType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::LeaveType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::LikeType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::LikeType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::ListenType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::ListenType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,24 +1,22 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use object::Object;
mod accept;
mod add;
mod amove;
@ -79,6 +77,3 @@ pub use self::travel::*;
pub use self::undo::*;
pub use self::update::*;
pub use self::view::*;
pub trait Activity: Object {}
pub trait IntransitiveActivity: Activity {}

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::OfferType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::OfferType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,27 +1,25 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Link, Object};
use serde_json;
use link::Link;
use object::Object;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]
pub struct ActivityProperties {

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, IntransitiveActivity, Link, Object};
use serde_json;
use super::{kind::QuestionType, properties::ActivityProperties, Activity, IntransitiveActivity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::QuestionType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::ReadType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::ReadType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::RejectType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::RejectType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::RemoveType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::RemoveType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::TentativeAcceptType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::TentativeAcceptType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::TentativeRejectType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::TentativeRejectType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, IntransitiveActivity, Link, Object};
use serde_json;
use super::{kind::TravelType, properties::ActivityProperties, Activity, IntransitiveActivity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::TravelType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::UndoType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::UndoType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::UpdateType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::UpdateType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,28 +1,27 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use activitystreams_traits::{Activity, Link, Object};
use serde_json;
use super::{kind::ViewType, properties::ActivityProperties, Activity};
use link::Link;
use object::{properties::ObjectProperties, Object};
use super::{kind::ViewType, properties::ActivityProperties};
use object::properties::ObjectProperties;
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]

View file

@ -1,22 +1,24 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
//! Namespace for Unit Structs that serialize to strings
use std::fmt;
use serde::{

View file

@ -1,85 +1,102 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use object::{properties::ObjectProperties, Object};
//! Namespace for Actor types
use activitystreams_traits::{Actor, Object};
use object::properties::ObjectProperties;
mod kind;
pub use self::kind::*;
pub trait Actor: Object {}
/// Describes a software application.
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Appliation {
#[serde(rename = "type")]
kind: ApplicationType,
/// Adds all valid object properties to this struct
#[serde(flatten)]
pub object_props: ObjectProperties,
}
impl Object for Appliation {}
impl Actor for Appliation {}
/// Represents a formal or informal collective of Actors.
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Group {
#[serde(rename = "type")]
kind: GroupType,
/// Adds all valid object properties to this struct
#[serde(flatten)]
pub object_props: ObjectProperties,
}
impl Object for Group {}
impl Actor for Group {}
/// Represents an organization.
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Organization {
#[serde(rename = "type")]
kind: OrganizationType,
/// Adds all valid object properties to this struct
#[serde(flatten)]
pub object_props: ObjectProperties,
}
impl Object for Organization {}
impl Actor for Organization {}
/// Represents an individual person.
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Person {
#[serde(rename = "type")]
kind: PersonType,
/// Adds all valid object properties to this struct
#[serde(flatten)]
pub object_props: ObjectProperties,
}
impl Object for Person {}
impl Actor for Person {}
/// Represents a service of any kind.
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Service {
#[serde(rename = "type")]
kind: ServiceType,
/// Adds all valid object properties to this struct
#[serde(flatten)]
pub object_props: ObjectProperties,
}
impl Object for Service {}
impl Actor for Service {}

View file

@ -1,22 +1,24 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
//! Namespace for Unit Structs that serialize to strings
use std::fmt;
use serde::{

View file

@ -1,35 +1,33 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use object::{properties::ObjectProperties, Object};
//! Namespace for Collection types
use activitystreams_traits::{Collection, CollectionPage, Object};
use object::properties::ObjectProperties;
pub mod kind;
pub mod properties;
use self::kind::*;
use self::properties::*;
/// A Collection is a subtype of `Object` that represents ordered or unordered sets of `Object` or
/// `Link` instances.
pub trait Collection: Object {}
pub trait CollectionPage: Object {}
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
#[serde(rename_all = "camelCase")]
pub struct UnorderedCollection {
@ -90,6 +88,7 @@ pub struct UnorderedCollectionPage {
impl Object for UnorderedCollectionPage {}
impl Collection for UnorderedCollectionPage {}
impl CollectionPage for UnorderedCollectionPage {}
/// Used to represent ordered subsets of items from an `OrderedCollection`.
#[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)]
@ -117,3 +116,4 @@ pub struct OrderedCollectionPage {
impl Object for OrderedCollectionPage {}
impl Collection for OrderedCollectionPage {}
impl CollectionPage for OrderedCollectionPage {}

View file

@ -1,20 +1,20 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. 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
@ -56,14 +56,9 @@
//! # fn main() {}
//! ```
use activitystreams_traits::{Collection, CollectionPage, Link, Object};
use serde_json;
use super::{
OrderedCollection, OrderedCollectionPage, UnorderedCollection, UnorderedCollectionPage,
};
use link::Link;
use object::Object;
/// `Collection` objects are a specialization of the base `Object` that serve as a container for
/// other `Objects` or `Links`.
///
@ -96,32 +91,26 @@ pub struct CollectionProperties {
/// In a paged `Collection`, indicates the page that contains the most recently updated member
/// items.
///
/// - Range: `CollectionPage` | `OrderedCollectionPage` | `Link`
/// - Range: `CollectionPage` | `Link`
/// - Functional: true
#[serde(skip_serializing_if = "Option::is_none")]
#[activitystreams(
concrete(UnorderedCollectionPage, OrderedCollectionPage), ab(Link), functional
)]
#[activitystreams(ab(Link, CollectionPage), functional)]
pub current: Option<serde_json::Value>,
/// In a paged `Collection`, indicates the furthest preceeding page of items in the collection.
///
/// - Range: `CollectionPage` | `OrderedCollectionPage` | `Link`
/// - Range: `CollectionPage` | `Link`
/// - Functional: true
#[serde(skip_serializing_if = "Option::is_none")]
#[activitystreams(
concrete(UnorderedCollectionPage, OrderedCollectionPage), ab(Link), functional
)]
#[activitystreams(ab(Link, CollectionPage), functional)]
pub first: Option<serde_json::Value>,
/// In a paged `Collection`, indicates the furthest proceeding page of the collection.
///
/// - Range: `CollectionPage` | `OrderedCollectionPage` | `Link`
/// - Range: `CollectionPage` | `Link`
/// - Functional: true
#[serde(skip_serializing_if = "Option::is_none")]
#[activitystreams(
concrete(UnorderedCollectionPage, OrderedCollectionPage), ab(Link), functional
)]
#[activitystreams(ab(Link, CollectionPage), functional)]
pub last: Option<serde_json::Value>,
}
@ -132,26 +121,26 @@ pub struct CollectionProperties {
pub struct CollectionPageProperties {
/// Identifies the `Collection` to which a `CollectionPage` objects items belong.
///
/// Range: `Collection` | `OrderedCollection` | `Link`
/// Range: `Collection` | `Link`
/// Functional: true
#[serde(skip_serializing_if = "Option::is_none")]
#[activitystreams(concrete(UnorderedCollection, OrderedCollection), ab(Link), functional)]
#[activitystreams(ab(Link, Collection), functional)]
pub part_of: Option<serde_json::Value>,
/// In a paged `Collection`, indicates the next page of items.
///
/// - Range: `CollectionPage` | `OrderedCollectionPage` | `Link`
/// - Range: `CollectionPage` | `Link`
/// - Functional: true
#[serde(skip_serializing_if = "Option::is_none")]
#[activitystreams(concrete(UnorderedCollectionPage), ab(Link), functional)]
#[activitystreams(ab(Link, CollectionPage), functional)]
pub next: Option<serde_json::Value>,
/// In a paged `Collection`, identifies the previous page of items.
///
/// - Range: `CollectionPage` | `OrderedCollectionPage` | `Link`
/// - Range: `CollectionPage` | `Link`
/// - Functional: true
#[serde(skip_serializing_if = "Option::is_none")]
#[activitystreams(concrete(UnorderedCollectionPage), ab(Link), functional)]
#[activitystreams(ab(Link, CollectionPage), functional)]
pub prev: Option<serde_json::Value>,
}

View file

@ -0,0 +1,150 @@
/*
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
//! A collection of simple types for extending the ActivityStreams Types base types
use serde::{de::DeserializeOwned, ser::Serialize};
use activitystreams_traits::{
Activity, Actor, Collection, CollectionPage, IntransitiveActivity, Link, Object,
};
/// A custom type extending Link
///
/// CustomLink allows for providing a pre-defined Link type, and a set of extending properties, and
/// treating those two items as a single Link type.
///
/// ## Example
/// ```rust
/// use activitystreams::{
/// custom_props::CustomLink,
/// link::Mention,
/// };
///
/// struct MyProps {
/// some_prop: String,
/// }
///
/// fn main() {
/// let mention = Mention::default();
/// let extended_mention = CustomLink::new(mention, MyProps { some_prop: "hey".to_owned() });
/// }
/// ```
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CustomLink<C, L> {
#[serde(flatten)]
pub link: L,
#[serde(flatten)]
pub custom_props: C,
}
impl<C, L: Link> CustomLink<C, L> {
pub fn new(link: L, custom_props: C) -> Self {
CustomLink { link, custom_props }
}
}
impl<C, L> Link for CustomLink<C, L>
where
C: DeserializeOwned + Serialize,
L: Link,
{
}
/// A custom type extending Object
///
/// CustomObject allows for providing a pre-defined Link type, and a set of extending properties,
/// and treating those two items as a single Object type.
///
/// This type can also be used to extend any type deriving from Object, such as Actor, Activity, or
/// Collection.
///
/// ## Example
/// ```rust
/// use activitystreams::{
/// custom_props::CustomObject,
/// object::Video,
/// };
///
/// struct MyProps {
/// some_prop: String,
/// }
///
/// fn main() {
/// let video = Video::default();
/// let extended_video = CustomObject::new(video, MyProps { some_prop: "hey".to_owned() });
/// }
/// ```
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CustomObject<C, O> {
#[serde(flatten)]
pub object: O,
#[serde(flatten)]
pub custom_props: C,
}
impl<C, O: Object> CustomObject<C, O> {
pub fn new(object: O, custom_props: C) -> Self {
CustomObject {
object,
custom_props,
}
}
}
impl<C, O> Object for CustomObject<C, O>
where
C: DeserializeOwned + Serialize,
O: Object,
{
}
impl<C, O> Actor for CustomObject<C, O>
where
C: DeserializeOwned + Serialize,
O: Actor,
{
}
impl<C, O> Collection for CustomObject<C, O>
where
C: DeserializeOwned + Serialize,
O: Collection,
{
}
impl<C, O> CollectionPage for CustomObject<C, O>
where
C: DeserializeOwned + Serialize,
O: CollectionPage,
{
}
impl<C, O> Activity for CustomObject<C, O>
where
C: DeserializeOwned + Serialize,
O: Activity,
{
}
impl<C, O> IntransitiveActivity for CustomObject<C, O>
where
C: DeserializeOwned + Serialize,
O: IntransitiveActivity,
{
}

View file

@ -0,0 +1,44 @@
/*
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
#[macro_use]
extern crate activitystreams_derive;
extern crate activitystreams_traits;
extern crate chrono;
extern crate mime;
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
pub fn context() -> serde_json::Value {
json!({
"one": "two",
})
}
pub mod activity;
pub mod actor;
pub mod collection;
mod custom_props;
pub mod link;
pub mod object;
pub use self::custom_props::{CustomLink, CustomObject};

View file

@ -1,20 +1,20 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
//! Namespace for Unit Structs that serialize to strings

View file

@ -1,32 +1,31 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
use serde::{de::DeserializeOwned, ser::Serialize};
//! Namespace for Link types
use activitystreams_traits::Link;
pub mod kind;
pub mod properties;
use self::kind::*;
use self::properties::*;
/// The Link is the secondary base type for the Activity Streams vocabulary.
pub trait Link: DeserializeOwned + Serialize {}
/// A specialized Link that represents an @mention.
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]

View file

@ -1,20 +1,20 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. 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 link types
@ -47,13 +47,10 @@
//! # fn main() {}
//! ```
use activitystreams_traits::{Error, Link, Object, Result};
use mime;
use serde_json;
use error::{Error, Result};
use link::Link;
use object::Object;
/// Define all the properties of the Object base type as described by the Activity Streams
/// vocabulary.
///

View file

@ -1,20 +1,20 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
//! Namespace for Unit Structs that serialize to strings

View file

@ -1,34 +1,31 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
* along with ActivityStreams Types. If not, see <http://www.gnu.org/licenses/>.
*/
//! Namespace for Object types
use serde::{de::DeserializeOwned, ser::Serialize};
use activitystreams_traits::Object;
pub mod kind;
pub mod properties;
use self::kind::*;
use self::properties::*;
/// The Object is the primary base type for the Activity Streams vocabulary.
pub trait Object: DeserializeOwned + Serialize {}
/// Represents any kind of multi-paragraph written work.
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]

View file

@ -1,20 +1,20 @@
/*
* This file is part of ActivityStreams.
* This file is part of ActivityStreams Types.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* ActivityStreams Types is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* ActivityStreams Types is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. 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
@ -47,14 +47,12 @@
//! # fn main() {}
//! ```
use activitystreams_traits::{Collection, Error, Link, Object, Result};
use chrono::{offset::Utc, DateTime};
use mime;
use serde_json;
use collection::Collection;
use error::{Error, Result};
use link::Link;
use object::{Image, Object};
use object::Image;
/// Alias chrono::DateTime<Utc> for use in derive macros
pub type UtcTime = DateTime<Utc>;

21
src/activity.rs Normal file
View file

@ -0,0 +1,21 @@
/*
* This file is part of ActivityStreams.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
*/
pub use activitystreams_traits::{Activity, IntransitiveActivity};
pub use activitystreams_types::activity::*;

21
src/actor.rs Normal file
View file

@ -0,0 +1,21 @@
/*
* This file is part of ActivityStreams.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
*/
pub use activitystreams_traits::Actor;
pub use activitystreams_types::actor::*;

21
src/collection.rs Normal file
View file

@ -0,0 +1,21 @@
/*
* This file is part of ActivityStreams.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
*/
pub use activitystreams_traits::{Collection, CollectionPage};
pub use activitystreams_types::collection::*;

View file

@ -1,56 +0,0 @@
/*
* This file is part of ActivityStreams.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
*/
use link::Link;
use object::Object;
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CustomLink<C, L> {
#[serde(flatten)]
pub link: L,
#[serde(flatten)]
pub custom_props: C,
}
impl<C, L: Link> CustomLink<C, L> {
pub fn new(link: L, custom_props: C) -> Self {
CustomLink { link, custom_props }
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CustomObject<C, O> {
#[serde(flatten)]
pub object: O,
#[serde(flatten)]
pub custom_props: C,
}
impl<C, O: Object> CustomObject<C, O> {
pub fn new(object: O, custom_props: C) -> Self {
CustomObject {
object,
custom_props,
}
}
}

View file

@ -17,18 +17,4 @@
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
*/
use std::result;
#[derive(Copy, Clone, Debug, Fail)]
pub enum Error {
#[fail(display = "Key not present")]
NotFound,
#[fail(display = "Failed to deserialize data as requested type")]
Deserialize,
#[fail(display = "Failed to serialize data")]
Serialize,
}
pub type Result<T> = result::Result<T, Error>;
pub use activitystreams_traits::{Error, Result};

View file

@ -17,28 +17,12 @@
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
*/
#[macro_use]
extern crate activitystreams_derive;
extern crate chrono;
#[macro_use]
extern crate failure;
extern crate mime;
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
pub fn context() -> serde_json::Value {
json!({
"one": "two",
})
}
extern crate activitystreams_traits;
extern crate activitystreams_types;
pub mod activity;
pub mod actor;
pub mod collection;
pub mod custom_props;
pub mod error;
pub mod link;
pub mod object;
@ -47,7 +31,6 @@ pub mod properties;
pub use self::activity::{Activity, IntransitiveActivity};
pub use self::actor::Actor;
pub use self::collection::{Collection, CollectionPage};
pub use self::custom_props::{CustomLink, CustomObject};
pub use self::error::Error;
pub use self::link::Link;
pub use self::object::Object;

21
src/link.rs Normal file
View file

@ -0,0 +1,21 @@
/*
* This file is part of ActivityStreams.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
*/
pub use activitystreams_traits::Link;
pub use activitystreams_types::link::*;

21
src/object.rs Normal file
View file

@ -0,0 +1,21 @@
/*
* This file is part of ActivityStreams.
*
* Copyright © 2018 Riley Trautman
*
* ActivityStreams is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ActivityStreams is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
*/
pub use activitystreams_traits::Object;
pub use activitystreams_types::object::*;

View file

@ -17,65 +17,4 @@
* along with ActivityStreams. If not, see <http://www.gnu.org/licenses/>.
*/
use serde::{de::DeserializeOwned, ser::Serialize};
use serde_json;
use error::{Error, Result};
pub fn from_value<I>(item: &serde_json::Value) -> Result<I>
where
I: DeserializeOwned,
{
serde_json::from_value(item.clone()).map_err(|_| Error::Deserialize)
}
pub fn to_value<I>(item: I) -> Result<serde_json::Value>
where
I: Serialize,
{
serde_json::to_value(item).map_err(|_| Error::Serialize)
}
pub fn from_item<I>(item: &Option<serde_json::Value>) -> Result<I>
where
I: DeserializeOwned,
{
if let &Some(ref item) = item {
from_value(item)
} else {
Err(Error::NotFound)
}
}
pub fn to_item<I>(item: I) -> Result<Option<serde_json::Value>>
where
I: Serialize,
{
to_value(item).map(Some)
}
pub fn from_vec<I>(v: &Vec<serde_json::Value>) -> Result<Vec<I>>
where
I: DeserializeOwned,
{
v.iter().fold(Ok(Vec::new()), |acc, item| match acc {
Ok(mut acc) => from_value(item).map(|item| {
acc.push(item);
acc
}),
e => e,
})
}
pub fn to_vec<I>(v: Vec<I>) -> Result<Vec<serde_json::Value>>
where
I: Serialize,
{
v.into_iter().fold(Ok(Vec::new()), |acc, item| match acc {
Ok(mut acc) => to_value(item).map(|item| {
acc.push(item);
acc
}),
e => e,
})
}
pub use activitystreams_traits::properties::*;