From 503bb1a1e775d4992bb51b92c9fae41957401730 Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 28 Oct 2019 18:18:12 -0500 Subject: [PATCH] Update to 2018 edition --- Cargo.toml | 1 + activitystreams-derive/Cargo.toml | 7 +- activitystreams-derive/src/lib.rs | 87 ++++++++----------- activitystreams-traits/Cargo.toml | 1 + activitystreams-traits/src/activity.rs | 2 +- activitystreams-traits/src/actor.rs | 2 +- activitystreams-traits/src/collection.rs | 2 +- activitystreams-traits/src/lib.rs | 10 +-- activitystreams-traits/src/properties.rs | 3 +- activitystreams-types/Cargo.toml | 1 + activitystreams-types/src/activity/accept.rs | 4 +- activitystreams-types/src/activity/add.rs | 4 +- activitystreams-types/src/activity/amove.rs | 4 +- .../src/activity/announce.rs | 4 +- activitystreams-types/src/activity/arrive.rs | 4 +- activitystreams-types/src/activity/block.rs | 4 +- activitystreams-types/src/activity/create.rs | 4 +- activitystreams-types/src/activity/delete.rs | 4 +- activitystreams-types/src/activity/dislike.rs | 4 +- activitystreams-types/src/activity/flag.rs | 4 +- activitystreams-types/src/activity/follow.rs | 4 +- activitystreams-types/src/activity/ignore.rs | 4 +- activitystreams-types/src/activity/invite.rs | 4 +- activitystreams-types/src/activity/join.rs | 4 +- activitystreams-types/src/activity/kind.rs | 2 + activitystreams-types/src/activity/leave.rs | 4 +- activitystreams-types/src/activity/like.rs | 4 +- activitystreams-types/src/activity/listen.rs | 4 +- activitystreams-types/src/activity/mod.rs | 34 ++------ activitystreams-types/src/activity/offer.rs | 4 +- .../src/activity/properties.rs | 10 +-- .../src/activity/question.rs | 4 +- activitystreams-types/src/activity/read.rs | 4 +- activitystreams-types/src/activity/reject.rs | 4 +- activitystreams-types/src/activity/remove.rs | 4 +- .../src/activity/tentative_accept.rs | 4 +- .../src/activity/tentative_reject.rs | 4 +- activitystreams-types/src/activity/travel.rs | 4 +- activitystreams-types/src/activity/undo.rs | 4 +- activitystreams-types/src/activity/update.rs | 4 +- activitystreams-types/src/activity/view.rs | 4 +- activitystreams-types/src/actor/kind.rs | 1 + activitystreams-types/src/actor/mod.rs | 3 +- activitystreams-types/src/collection/kind.rs | 1 + activitystreams-types/src/collection/mod.rs | 4 +- .../src/collection/properties.rs | 10 +-- activitystreams-types/src/custom_props.rs | 29 ++++--- activitystreams-types/src/lib.rs | 14 +-- activitystreams-types/src/link/kind.rs | 1 + activitystreams-types/src/link/mod.rs | 1 + activitystreams-types/src/link/properties.rs | 11 +-- activitystreams-types/src/object/kind.rs | 1 + activitystreams-types/src/object/mod.rs | 2 + .../src/object/properties.rs | 13 +-- src/lib.rs | 23 +---- 55 files changed, 188 insertions(+), 200 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 79bd4fd..3eea3bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ authors = ["asonix "] repository = "https://git.asonix.dog/Aardwolf/activitystreams" readme = "README.md" keywords = ["activitystreams", "activitypub"] +edition = "2018" [dependencies] activitystreams-traits = { version = "0.2", path = "activitystreams-traits" } diff --git a/activitystreams-derive/Cargo.toml b/activitystreams-derive/Cargo.toml index cfc9ca0..a07873c 100644 --- a/activitystreams-derive/Cargo.toml +++ b/activitystreams-derive/Cargo.toml @@ -7,11 +7,12 @@ authors = ["asonix "] repository = "https://git.asonix.dog/Aardwolf/activitystreams" readme = "README.md" keywords = ["activitystreams", "activitypub"] +edition = "2018" [dependencies] -quote = "0.5" -syn = "0.13" -proc-macro2 = "0.3" +quote = "1.0" +syn = "1.0" +proc-macro2 = "1.0" [dev-dependencies] activitystreams-traits = { version = "0.2", path = "../activitystreams-traits" } diff --git a/activitystreams-derive/src/lib.rs b/activitystreams-derive/src/lib.rs index d13c55f..344249f 100644 --- a/activitystreams-derive/src/lib.rs +++ b/activitystreams-derive/src/lib.rs @@ -22,15 +22,9 @@ //! ## Examples //! //! ```rust -//! #[macro_use] -//! extern crate activitystreams_derive; -//! extern crate activitystreams_traits; -//! extern crate serde; -//! #[macro_use] -//! extern crate serde_derive; -//! extern crate serde_json; -//! +//! use activitystreams_derive::{Properties, UnitString}; //! use activitystreams_traits::{Link, Object}; +//! use serde_derive::{Deserialize, Serialize}; //! //! /// Using the UnitString derive macro //! /// @@ -68,17 +62,14 @@ //! ``` extern crate proc_macro; -extern crate proc_macro2; -extern crate syn; - -#[macro_use] -extern crate quote; use proc_macro::TokenStream; use proc_macro2::TokenTree; -use quote::Tokens; +use quote::quote; use syn::{Attribute, Data, DeriveInput, Fields, Ident, Type}; +use std::iter::FromIterator; + #[proc_macro_derive(UnitString, attributes(activitystreams))] pub fn unit_string(input: TokenStream) -> TokenStream { let input: DeriveInput = syn::parse(input).unwrap(); @@ -93,16 +84,14 @@ pub fn unit_string(input: TokenStream) -> TokenStream { .path .segments .last() - .map(|segment| { - let segment = segment.into_value(); - segment.ident == Ident::new("activitystreams", segment.ident.span()) - }).unwrap_or(false) - }).unwrap() + .map(|segment| segment.ident == Ident::new("activitystreams", segment.ident.span())) + .unwrap_or(false) + }) + .unwrap() .clone(); - let value = from_value(attr); - - let visitor_name = Ident::from(format!("{}Visitor", value)); + let visitor_name = from_value(attr); + let value = format!("\"{}\"", visitor_name); let serialize = quote! { impl ::serde::ser::Serialize for #name { @@ -166,15 +155,16 @@ pub fn unit_string(input: TokenStream) -> TokenStream { c.into() } -fn from_value(attr: Attribute) -> String { +fn from_value(attr: Attribute) -> Ident { let group = attr - .tts + .tokens .clone() .into_iter() .filter_map(|token_tree| match token_tree { TokenTree::Group(group) => Some(group), _ => None, - }).next() + }) + .next() .unwrap(); group @@ -182,9 +172,10 @@ fn from_value(attr: Attribute) -> String { .clone() .into_iter() .filter_map(|token_tree| match token_tree { - TokenTree::Term(term) => Some(term.as_str().to_owned()), + TokenTree::Ident(ident) => Some(ident), _ => None, - }).next() + }) + .next() .unwrap() } @@ -214,7 +205,6 @@ pub fn properties_derive(input: TokenStream) -> TokenStream { .segments .last() .map(|segment| { - let segment = segment.into_value(); segment.ident == Ident::new("activitystreams", segment.ident.span()) }) .unwrap_or(false) @@ -228,7 +218,6 @@ pub fn properties_derive(input: TokenStream) -> TokenStream { .segments .last() .map(|seg| { - let seg = seg.into_value(); seg.ident == Ident::new("Option", seg.ident.span()) }) .unwrap_or(false), @@ -240,7 +229,6 @@ pub fn properties_derive(input: TokenStream) -> TokenStream { .segments .last() .map(|seg| { - let seg = seg.into_value(); seg.ident == Ident::new("Vec", seg.ident.span()) }) .unwrap_or(false), @@ -262,12 +250,11 @@ pub fn properties_derive(input: TokenStream) -> TokenStream { variants(attr) .into_iter() .map(move |(variant, is_concrete)| { - let lower_variant = variant.to_lowercase(); - let fn_name = Ident::from(format!("{}_{}", ident, lower_variant)); - let fn_plural = Ident::from(format!("{}_{}_vec", ident, lower_variant)); - let set_fn_name = Ident::from(format!("set_{}_{}", ident, lower_variant)); - let set_fn_plural = Ident::from(format!("set_{}_{}_vec", ident, lower_variant)); - let variant = Ident::from(variant); + let lower_variant = variant.to_string().to_lowercase(); + let fn_name = Ident::new(&format!("{}_{}", ident, lower_variant), variant.span()); + let fn_plural = Ident::new(&format!("{}_{}_vec", ident, lower_variant), variant.span()); + let set_fn_name = Ident::new(&format!("set_{}_{}", ident, lower_variant), variant.span()); + let set_fn_plural = Ident::new(&format!("set_{}_{}_vec", ident, lower_variant), variant.span()); if is_concrete { if is_option { @@ -592,10 +579,9 @@ pub fn properties_derive(input: TokenStream) -> TokenStream { }) }); - let mut tokens = Tokens::new(); - tokens.append_all(impls); + let tokens = proc_macro2::TokenStream::from_iter(impls); - let full = quote!{ + let full = quote! { impl #name { #tokens } @@ -604,15 +590,16 @@ pub fn properties_derive(input: TokenStream) -> TokenStream { full.into() } -fn variants(attr: Attribute) -> Vec<(String, bool)> { +fn variants(attr: Attribute) -> Vec<(Ident, bool)> { let group = attr - .tts + .tokens .clone() .into_iter() .filter_map(|token_tree| match token_tree { TokenTree::Group(group) => Some(group), _ => None, - }).next() + }) + .next() .unwrap(); let mut is_concrete = false; @@ -622,30 +609,32 @@ fn variants(attr: Attribute) -> Vec<(String, bool)> { .clone() .into_iter() .filter_map(|token_tree| match token_tree { - TokenTree::Term(term) => { - is_concrete = term.as_str() == "concrete"; + TokenTree::Ident(ident) => { + is_concrete = ident.to_string() == "concrete"; None } TokenTree::Group(group) => Some(group.stream().into_iter().filter_map( move |token_tree| match token_tree { - TokenTree::Term(term) => Some((term.as_str().to_owned(), is_concrete)), + TokenTree::Ident(ident) => Some((ident, is_concrete)), _ => None, }, )), _ => None, - }).flat_map(|i| i) + }) + .flat_map(|i| i) .collect() } fn is_functional(attr: Attribute) -> bool { let group = attr - .tts + .tokens .clone() .into_iter() .filter_map(|token_tree| match token_tree { TokenTree::Group(group) => Some(group), _ => None, - }).next() + }) + .next() .unwrap(); group @@ -653,7 +642,7 @@ fn is_functional(attr: Attribute) -> bool { .clone() .into_iter() .any(|token_tree| match token_tree { - TokenTree::Term(term) => term.as_str() == "functional", + TokenTree::Ident(ident) => ident.to_string() == "functional", _ => false, }) } diff --git a/activitystreams-traits/Cargo.toml b/activitystreams-traits/Cargo.toml index 4292c52..ad7a11c 100644 --- a/activitystreams-traits/Cargo.toml +++ b/activitystreams-traits/Cargo.toml @@ -7,6 +7,7 @@ authors = ["asonix "] repository = "https://git.asonix.dog/Aardwolf/activitystreams" readme = "README.md" keywords = ["activitystreams", "activitypub"] +edition = "2018" [dependencies] serde = "1.0" diff --git a/activitystreams-traits/src/activity.rs b/activitystreams-traits/src/activity.rs index d2506f8..f0c7281 100644 --- a/activitystreams-traits/src/activity.rs +++ b/activitystreams-traits/src/activity.rs @@ -17,7 +17,7 @@ * along with ActivityStreams Traits. If not, see . */ -use object::Object; +use crate::object::Object; /// An Activity is a subtype of `Object` that describes some form of action that may happen, is /// currently happening, or has already happened. diff --git a/activitystreams-traits/src/actor.rs b/activitystreams-traits/src/actor.rs index 6935b46..d6b5757 100644 --- a/activitystreams-traits/src/actor.rs +++ b/activitystreams-traits/src/actor.rs @@ -17,7 +17,7 @@ * along with ActivityStreams Traits. If not, see . */ -use object::Object; +use crate::object::Object; /// `Actor` types are `Object` types that are capable of performing activities. /// diff --git a/activitystreams-traits/src/collection.rs b/activitystreams-traits/src/collection.rs index 6545703..38c504a 100644 --- a/activitystreams-traits/src/collection.rs +++ b/activitystreams-traits/src/collection.rs @@ -17,7 +17,7 @@ * along with ActivityStreams Traits. If not, see . */ -use object::Object; +use crate::object::Object; /// A Collection is a subtype of `Object` that represents ordered or unordered sets of `Object` or /// `Link` instances. diff --git a/activitystreams-traits/src/lib.rs b/activitystreams-traits/src/lib.rs index 9e6745c..24e3e92 100644 --- a/activitystreams-traits/src/lib.rs +++ b/activitystreams-traits/src/lib.rs @@ -25,13 +25,8 @@ //! ## Examples //! //! ```rust -//! extern crate activitystreams_traits; -//! extern crate serde; -//! #[macro_use] -//! extern crate serde_derive; -//! extern crate serde_json; -//! //! use activitystreams_traits::{Object, Actor}; +//! use serde_derive::{Deserialize, Serialize}; //! //! #[derive(Clone, Debug, Default, Deserialize, Serialize)] //! #[serde(rename_all = "camelCase")] @@ -49,9 +44,6 @@ //! # fn main() {} //! ``` -extern crate serde; -extern crate serde_json; - mod activity; mod actor; mod collection; diff --git a/activitystreams-traits/src/properties.rs b/activitystreams-traits/src/properties.rs index 2cc1c64..3f42888 100644 --- a/activitystreams-traits/src/properties.rs +++ b/activitystreams-traits/src/properties.rs @@ -21,9 +21,8 @@ //! types use serde::{de::DeserializeOwned, ser::Serialize}; -use serde_json; -use error::{Error, Result}; +use crate::error::{Error, Result}; /// Deserialize a `Value` into concrete type I pub fn from_value(item: &serde_json::Value) -> Result diff --git a/activitystreams-types/Cargo.toml b/activitystreams-types/Cargo.toml index bb500c4..31d30e5 100644 --- a/activitystreams-types/Cargo.toml +++ b/activitystreams-types/Cargo.toml @@ -7,6 +7,7 @@ authors = ["asonix "] repository = "https://git.asonix.dog/Aardwolf/activitystreams" readme = "README.md" keywords = ["activitystreams", "activitypub"] +edition = "2018" [dependencies] activitystreams-derive = { version = "0.2", path = "../activitystreams-derive" } diff --git a/activitystreams-types/src/activity/accept.rs b/activitystreams-types/src/activity/accept.rs index 7b440af..ac84552 100644 --- a/activitystreams-types/src/activity/accept.rs +++ b/activitystreams-types/src/activity/accept.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::AcceptType, properties::{AcceptProperties, ActivityProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor accepts the object. /// diff --git a/activitystreams-types/src/activity/add.rs b/activitystreams-types/src/activity/add.rs index 8c81a56..fd9e613 100644 --- a/activitystreams-types/src/activity/add.rs +++ b/activitystreams-types/src/activity/add.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::AddType, properties::{ActivityProperties, AddProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor has added the object to the target. /// diff --git a/activitystreams-types/src/activity/amove.rs b/activitystreams-types/src/activity/amove.rs index eff4200..97afe9e 100644 --- a/activitystreams-types/src/activity/amove.rs +++ b/activitystreams-types/src/activity/amove.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::MoveType, properties::{ActivityProperties, MoveProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor has moved object from origin to target. /// diff --git a/activitystreams-types/src/activity/announce.rs b/activitystreams-types/src/activity/announce.rs index 947eb7b..6caa53e 100644 --- a/activitystreams-types/src/activity/announce.rs +++ b/activitystreams-types/src/activity/announce.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::AnnounceType, properties::{ActivityProperties, AnnounceProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor is calling the target's attention the object. /// diff --git a/activitystreams-types/src/activity/arrive.rs b/activitystreams-types/src/activity/arrive.rs index da49a6c..9aa336e 100644 --- a/activitystreams-types/src/activity/arrive.rs +++ b/activitystreams-types/src/activity/arrive.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, IntransitiveActivity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::ArriveType, properties::{ActivityProperties, ArriveProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// An IntransitiveActivity that indicates that the actor has arrived at the location. /// diff --git a/activitystreams-types/src/activity/block.rs b/activitystreams-types/src/activity/block.rs index 4e82d11..eaf6895 100644 --- a/activitystreams-types/src/activity/block.rs +++ b/activitystreams-types/src/activity/block.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::BlockType, properties::{ActivityProperties, BlockProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor is blocking the object. /// diff --git a/activitystreams-types/src/activity/create.rs b/activitystreams-types/src/activity/create.rs index 3d9235d..7e6e543 100644 --- a/activitystreams-types/src/activity/create.rs +++ b/activitystreams-types/src/activity/create.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::CreateType, properties::{ActivityProperties, CreateProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor has created the object. #[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] diff --git a/activitystreams-types/src/activity/delete.rs b/activitystreams-types/src/activity/delete.rs index 155c674..4740c36 100644 --- a/activitystreams-types/src/activity/delete.rs +++ b/activitystreams-types/src/activity/delete.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::DeleteType, properties::{ActivityProperties, DeleteProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor has deleted the object. /// diff --git a/activitystreams-types/src/activity/dislike.rs b/activitystreams-types/src/activity/dislike.rs index 990a6ad..546d78f 100644 --- a/activitystreams-types/src/activity/dislike.rs +++ b/activitystreams-types/src/activity/dislike.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::DislikeType, properties::{ActivityProperties, DislikeProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor dislikes the object. #[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] diff --git a/activitystreams-types/src/activity/flag.rs b/activitystreams-types/src/activity/flag.rs index 00c6994..1c3f20b 100644 --- a/activitystreams-types/src/activity/flag.rs +++ b/activitystreams-types/src/activity/flag.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::FlagType, properties::{ActivityProperties, FlagProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor is "flagging" the object. /// diff --git a/activitystreams-types/src/activity/follow.rs b/activitystreams-types/src/activity/follow.rs index 4af6cb6..ab7119c 100644 --- a/activitystreams-types/src/activity/follow.rs +++ b/activitystreams-types/src/activity/follow.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::FollowType, properties::{ActivityProperties, FollowProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor is "following" the object. /// diff --git a/activitystreams-types/src/activity/ignore.rs b/activitystreams-types/src/activity/ignore.rs index 8ba1a28..c53c87f 100644 --- a/activitystreams-types/src/activity/ignore.rs +++ b/activitystreams-types/src/activity/ignore.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::IgnoreType, properties::{ActivityProperties, IgnoreProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor is ignoring the object. /// diff --git a/activitystreams-types/src/activity/invite.rs b/activitystreams-types/src/activity/invite.rs index 5994954..65ec08b 100644 --- a/activitystreams-types/src/activity/invite.rs +++ b/activitystreams-types/src/activity/invite.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::InviteType, properties::{ActivityProperties, InviteProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// A specialization of Offer in which the actor is extending an invitation for the object to the /// target. diff --git a/activitystreams-types/src/activity/join.rs b/activitystreams-types/src/activity/join.rs index ca89d5c..71ae385 100644 --- a/activitystreams-types/src/activity/join.rs +++ b/activitystreams-types/src/activity/join.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::JoinType, properties::{ActivityProperties, JoinProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor has joined the object. /// diff --git a/activitystreams-types/src/activity/kind.rs b/activitystreams-types/src/activity/kind.rs index 6ca3534..c167161 100644 --- a/activitystreams-types/src/activity/kind.rs +++ b/activitystreams-types/src/activity/kind.rs @@ -19,6 +19,8 @@ //! Namespace for Unit Structs that serialize to strings +use activitystreams_derive::UnitString; + #[derive(Clone, Debug, Default, UnitString)] #[activitystreams(Accept)] pub struct AcceptType; diff --git a/activitystreams-types/src/activity/leave.rs b/activitystreams-types/src/activity/leave.rs index efedb4a..88f15a8 100644 --- a/activitystreams-types/src/activity/leave.rs +++ b/activitystreams-types/src/activity/leave.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::LeaveType, properties::{ActivityProperties, LeaveProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor has left the object. /// diff --git a/activitystreams-types/src/activity/like.rs b/activitystreams-types/src/activity/like.rs index a1d80c5..0288e70 100644 --- a/activitystreams-types/src/activity/like.rs +++ b/activitystreams-types/src/activity/like.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::LikeType, properties::{ActivityProperties, LikeProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor likes, recommends or endorses the object. /// diff --git a/activitystreams-types/src/activity/listen.rs b/activitystreams-types/src/activity/listen.rs index 3437238..97fa445 100644 --- a/activitystreams-types/src/activity/listen.rs +++ b/activitystreams-types/src/activity/listen.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::ListenType, properties::{ActivityProperties, ListenProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor has listened to the object. #[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] diff --git a/activitystreams-types/src/activity/mod.rs b/activitystreams-types/src/activity/mod.rs index f647c19..116f1b5 100644 --- a/activitystreams-types/src/activity/mod.rs +++ b/activitystreams-types/src/activity/mod.rs @@ -48,34 +48,12 @@ mod undo; mod update; mod view; -pub use self::accept::*; -pub use self::add::*; -pub use self::amove::*; -pub use self::announce::*; -pub use self::arrive::*; -pub use self::block::*; -pub use self::create::*; -pub use self::delete::*; -pub use self::dislike::*; -pub use self::flag::*; -pub use self::follow::*; -pub use self::ignore::*; -pub use self::invite::*; -pub use self::join::*; -pub use self::leave::*; -pub use self::like::*; -pub use self::listen::*; -pub use self::offer::*; -pub use self::question::*; -pub use self::read::*; -pub use self::reject::*; -pub use self::remove::*; -pub use self::tentative_accept::*; -pub use self::tentative_reject::*; -pub use self::travel::*; -pub use self::undo::*; -pub use self::update::*; -pub use self::view::*; +pub use self::{ + accept::*, add::*, amove::*, announce::*, arrive::*, block::*, create::*, delete::*, + dislike::*, flag::*, follow::*, ignore::*, invite::*, join::*, leave::*, like::*, listen::*, + offer::*, question::*, read::*, reject::*, remove::*, tentative_accept::*, tentative_reject::*, + travel::*, undo::*, update::*, view::*, +}; use activitystreams_traits::Activity; diff --git a/activitystreams-types/src/activity/offer.rs b/activitystreams-types/src/activity/offer.rs index c26cbec..6e84907 100644 --- a/activitystreams-types/src/activity/offer.rs +++ b/activitystreams-types/src/activity/offer.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::OfferType, properties::{ActivityProperties, OfferProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor is offering the object. /// diff --git a/activitystreams-types/src/activity/properties.rs b/activitystreams-types/src/activity/properties.rs index 432bc63..c871243 100644 --- a/activitystreams-types/src/activity/properties.rs +++ b/activitystreams-types/src/activity/properties.rs @@ -22,17 +22,12 @@ //! To use these properties in your own types, you can flatten them into your struct with serde: //! //! ```rust -//! extern crate activitystreams_traits; -//! extern crate activitystreams_types; -//! extern crate serde; -//! #[macro_use] -//! extern crate serde_derive; -//! //! use activitystreams_traits::{Activity, Object}; //! use activitystreams_types::{ //! activity::properties::ActivityProperties, //! object::properties::ObjectProperties, //! }; +//! use serde_derive::{Deserialize, Serialize}; //! //! #[derive(Clone, Debug, Serialize, Deserialize)] //! #[serde(rename_all = "camelCase")] @@ -58,8 +53,9 @@ //! # fn main() {} //! ``` +use activitystreams_derive::Properties; use activitystreams_traits::{Link, Object}; -use serde_json; +use serde_derive::{Deserialize, Serialize}; /// Activity objects are specializations of the base Object type that provide information about /// actions that have either already occurred, are in the process of occurring, or may occur in the diff --git a/activitystreams-types/src/activity/question.rs b/activitystreams-types/src/activity/question.rs index c49d40b..5e1d10a 100644 --- a/activitystreams-types/src/activity/question.rs +++ b/activitystreams-types/src/activity/question.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, IntransitiveActivity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::QuestionType, properties::{ActivityProperties, QuestionProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Represents a question being asked. /// diff --git a/activitystreams-types/src/activity/read.rs b/activitystreams-types/src/activity/read.rs index a4bd949..95ee730 100644 --- a/activitystreams-types/src/activity/read.rs +++ b/activitystreams-types/src/activity/read.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::ReadType, properties::{ActivityProperties, ReadProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor has read the object. #[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] diff --git a/activitystreams-types/src/activity/reject.rs b/activitystreams-types/src/activity/reject.rs index 3bf51d7..b973f20 100644 --- a/activitystreams-types/src/activity/reject.rs +++ b/activitystreams-types/src/activity/reject.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::RejectType, properties::{ActivityProperties, RejectProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor is rejecting the object. /// diff --git a/activitystreams-types/src/activity/remove.rs b/activitystreams-types/src/activity/remove.rs index a21e85c..46cd916 100644 --- a/activitystreams-types/src/activity/remove.rs +++ b/activitystreams-types/src/activity/remove.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::RemoveType, properties::{ActivityProperties, RemoveProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor is removing the object. /// diff --git a/activitystreams-types/src/activity/tentative_accept.rs b/activitystreams-types/src/activity/tentative_accept.rs index 19bf0c2..20180b7 100644 --- a/activitystreams-types/src/activity/tentative_accept.rs +++ b/activitystreams-types/src/activity/tentative_accept.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::TentativeAcceptType, properties::{ActivityProperties, TentativeAcceptProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// A specialization of Accept indicating that the acceptance is tentative. #[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] diff --git a/activitystreams-types/src/activity/tentative_reject.rs b/activitystreams-types/src/activity/tentative_reject.rs index 4973ded..988bab1 100644 --- a/activitystreams-types/src/activity/tentative_reject.rs +++ b/activitystreams-types/src/activity/tentative_reject.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::TentativeRejectType, properties::{ActivityProperties, TentativeRejectProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// A specialization of Reject in which the rejection is considered tentative. #[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] diff --git a/activitystreams-types/src/activity/travel.rs b/activitystreams-types/src/activity/travel.rs index 455445a..2565519 100644 --- a/activitystreams-types/src/activity/travel.rs +++ b/activitystreams-types/src/activity/travel.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, IntransitiveActivity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::TravelType, properties::{ActivityProperties, TravelProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor is traveling to target from origin. /// diff --git a/activitystreams-types/src/activity/undo.rs b/activitystreams-types/src/activity/undo.rs index 6344dfb..86771f6 100644 --- a/activitystreams-types/src/activity/undo.rs +++ b/activitystreams-types/src/activity/undo.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::UndoType, properties::{ActivityProperties, UndoProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor is undoing the object. /// diff --git a/activitystreams-types/src/activity/update.rs b/activitystreams-types/src/activity/update.rs index 24d760e..1b1b8c3 100644 --- a/activitystreams-types/src/activity/update.rs +++ b/activitystreams-types/src/activity/update.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::UpdateType, properties::{ActivityProperties, UpdateProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor has updated the object. /// diff --git a/activitystreams-types/src/activity/view.rs b/activitystreams-types/src/activity/view.rs index 3bd67f2..bfa3d6f 100644 --- a/activitystreams-types/src/activity/view.rs +++ b/activitystreams-types/src/activity/view.rs @@ -17,14 +17,16 @@ * along with ActivityStreams Types. If not, see . */ +use activitystreams_derive::Properties; use activitystreams_traits::{Activity, Object}; +use serde_derive::{Deserialize, Serialize}; use super::{ kind::ViewType, properties::{ActivityProperties, ViewProperties}, ActivityExt, }; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; /// Indicates that the actor has viewed the object. #[derive(Clone, Debug, Default, Deserialize, Serialize, Properties)] diff --git a/activitystreams-types/src/actor/kind.rs b/activitystreams-types/src/actor/kind.rs index bb86127..92b6634 100644 --- a/activitystreams-types/src/actor/kind.rs +++ b/activitystreams-types/src/actor/kind.rs @@ -18,6 +18,7 @@ */ //! Namespace for Unit Structs that serialize to strings +use activitystreams_derive::UnitString; #[derive(Clone, Debug, Default, UnitString)] #[activitystreams(Application)] diff --git a/activitystreams-types/src/actor/mod.rs b/activitystreams-types/src/actor/mod.rs index 5fa0fd3..bb16982 100644 --- a/activitystreams-types/src/actor/mod.rs +++ b/activitystreams-types/src/actor/mod.rs @@ -20,8 +20,9 @@ //! Namespace for Actor types use activitystreams_traits::{Actor, Object}; +use serde_derive::{Deserialize, Serialize}; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; pub mod kind; use self::kind::*; diff --git a/activitystreams-types/src/collection/kind.rs b/activitystreams-types/src/collection/kind.rs index 1b8545a..42118ec 100644 --- a/activitystreams-types/src/collection/kind.rs +++ b/activitystreams-types/src/collection/kind.rs @@ -18,6 +18,7 @@ */ //! Namespace for Unit Structs that serialize to strings +use activitystreams_derive::UnitString; #[derive(Clone, Debug, Default, UnitString)] #[activitystreams(Collection)] diff --git a/activitystreams-types/src/collection/mod.rs b/activitystreams-types/src/collection/mod.rs index 3bd5997..a444f5a 100644 --- a/activitystreams-types/src/collection/mod.rs +++ b/activitystreams-types/src/collection/mod.rs @@ -19,9 +19,11 @@ //! Namespace for Collection types +use activitystreams_derive::Properties; use activitystreams_traits::{Collection, CollectionPage, Object}; +use serde_derive::{Deserialize, Serialize}; -use object::{properties::ObjectProperties, ObjectExt}; +use crate::object::{properties::ObjectProperties, ObjectExt}; pub mod kind; pub mod properties; diff --git a/activitystreams-types/src/collection/properties.rs b/activitystreams-types/src/collection/properties.rs index dcc9c82..da3a9ab 100644 --- a/activitystreams-types/src/collection/properties.rs +++ b/activitystreams-types/src/collection/properties.rs @@ -22,17 +22,12 @@ //! To use these properties in your own types, you can flatten them into your struct with serde: //! //! ```rust -//! extern crate activitystreams_traits; -//! extern crate activitystreams_types; -//! extern crate serde; -//! #[macro_use] -//! extern crate serde_derive; -//! //! use activitystreams_traits::{Collection, Object}; //! use activitystreams_types::{ //! collection::properties::CollectionProperties, //! object::properties::ObjectProperties, //! }; +//! use serde_derive::{Deserialize, Serialize}; //! //! #[derive(Clone, Debug, Serialize, Deserialize)] //! #[serde(rename_all = "camelCase")] @@ -56,8 +51,9 @@ //! # fn main() {} //! ``` +use activitystreams_derive::Properties; use activitystreams_traits::{Collection, CollectionPage, Link, Object}; -use serde_json; +use serde_derive::{Deserialize, Serialize}; /// `Collection` objects are a specialization of the base `Object` that serve as a container for /// other `Objects` or `Links`. diff --git a/activitystreams-types/src/custom_props.rs b/activitystreams-types/src/custom_props.rs index e18ffd9..10ab248 100644 --- a/activitystreams-types/src/custom_props.rs +++ b/activitystreams-types/src/custom_props.rs @@ -19,11 +19,12 @@ //! A collection of simple types for extending the ActivityStreams Types base types -use serde::{de::DeserializeOwned, ser::Serialize}; +use serde::{de::DeserializeOwned, ser}; use activitystreams_traits::{ Activity, Actor, Collection, CollectionPage, IntransitiveActivity, Link, Object, }; +use serde_derive::{Deserialize, Serialize}; /// A custom type extending Link /// @@ -64,7 +65,7 @@ impl CustomLink { impl Link for CustomLink where - C: DeserializeOwned + Serialize, + C: DeserializeOwned + ser::Serialize, L: Link, { } @@ -114,33 +115,37 @@ impl CustomObject { impl Object for CustomObject where - C: DeserializeOwned + Serialize, + C: DeserializeOwned + ser::Serialize, O: Object, { } impl Actor for CustomObject where - C: DeserializeOwned + Serialize, + C: DeserializeOwned + ser::Serialize, O: Actor, { } impl Collection for CustomObject where - C: DeserializeOwned + Serialize, + C: DeserializeOwned + ser::Serialize, O: Collection, -{} +{ +} impl CollectionPage for CustomObject where - C: DeserializeOwned + Serialize, + C: DeserializeOwned + ser::Serialize, O: CollectionPage, -{} +{ +} impl Activity for CustomObject where - C: DeserializeOwned + Serialize, + C: DeserializeOwned + ser::Serialize, O: Activity, -{} +{ +} impl IntransitiveActivity for CustomObject where - C: DeserializeOwned + Serialize, + C: DeserializeOwned + ser::Serialize, O: IntransitiveActivity, -{} +{ +} diff --git a/activitystreams-types/src/lib.rs b/activitystreams-types/src/lib.rs index 65bb952..5244a1e 100644 --- a/activitystreams-types/src/lib.rs +++ b/activitystreams-types/src/lib.rs @@ -23,10 +23,6 @@ //! //! ## Example Usage //! ```rust -//! extern crate activitystreams_types; -//! extern crate anyhow; -//! extern crate serde_json; -//! //! use activitystreams_types::{context, link::Mention}; //! //! fn run() -> Result<(), anyhow::Error> { @@ -46,15 +42,7 @@ //! # } //! ``` -#[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; -extern crate serde_json; +use serde_derive::{Deserialize, Serialize}; /// Define a simple wrapper around a string for this crate's main Context type #[derive(Clone, Debug, Deserialize, Serialize)] diff --git a/activitystreams-types/src/link/kind.rs b/activitystreams-types/src/link/kind.rs index 3782136..adbcc6b 100644 --- a/activitystreams-types/src/link/kind.rs +++ b/activitystreams-types/src/link/kind.rs @@ -18,6 +18,7 @@ */ //! Namespace for Unit Structs that serialize to strings +use activitystreams_derive::UnitString; /// A Unit Struct that represents the string "Mention" #[derive(Clone, Debug, Default, UnitString)] diff --git a/activitystreams-types/src/link/mod.rs b/activitystreams-types/src/link/mod.rs index 2a8a7fa..175aabb 100644 --- a/activitystreams-types/src/link/mod.rs +++ b/activitystreams-types/src/link/mod.rs @@ -20,6 +20,7 @@ //! Namespace for Link types use activitystreams_traits::Link; +use serde_derive::{Deserialize, Serialize}; pub mod kind; pub mod properties; diff --git a/activitystreams-types/src/link/properties.rs b/activitystreams-types/src/link/properties.rs index a2bafa5..321c68e 100644 --- a/activitystreams-types/src/link/properties.rs +++ b/activitystreams-types/src/link/properties.rs @@ -22,14 +22,9 @@ //! To use these properties in your own types, you can flatten them into your struct with serde: //! //! ```rust -//! extern crate activitystreams_traits; -//! extern crate activitystreams_types; -//! extern crate serde; -//! #[macro_use] -//! extern crate serde_derive; -//! //! use activitystreams_traits::Link; //! use activitystreams_types::link::properties::LinkProperties; +//! use serde_derive::{Deserialize, Serialize}; //! //! #[derive(Clone, Debug, Serialize, Deserialize)] //! #[serde(rename_all = "camelCase")] @@ -49,9 +44,9 @@ //! # fn main() {} //! ``` +use activitystreams_derive::Properties; use activitystreams_traits::{Error, Link, Object, Result}; -use mime; -use serde_json; +use serde_derive::{Deserialize, Serialize}; /// Define all the properties of the Object base type as described by the Activity Streams /// vocabulary. diff --git a/activitystreams-types/src/object/kind.rs b/activitystreams-types/src/object/kind.rs index 8494c45..42ccc03 100644 --- a/activitystreams-types/src/object/kind.rs +++ b/activitystreams-types/src/object/kind.rs @@ -18,6 +18,7 @@ */ //! Namespace for Unit Structs that serialize to strings +use activitystreams_derive::UnitString; /// A Unit Struct that represents the string "Article" #[derive(Clone, Debug, Default, UnitString)] diff --git a/activitystreams-types/src/object/mod.rs b/activitystreams-types/src/object/mod.rs index 865e5cf..c653667 100644 --- a/activitystreams-types/src/object/mod.rs +++ b/activitystreams-types/src/object/mod.rs @@ -19,7 +19,9 @@ //! Namespace for Object types +use activitystreams_derive::Properties; use activitystreams_traits::Object; +use serde_derive::{Deserialize, Serialize}; pub mod kind; pub mod properties; diff --git a/activitystreams-types/src/object/properties.rs b/activitystreams-types/src/object/properties.rs index 14beadf..bd9ffcf 100644 --- a/activitystreams-types/src/object/properties.rs +++ b/activitystreams-types/src/object/properties.rs @@ -22,14 +22,9 @@ //! To use these properties in your own types, you can flatten them into your struct with serde: //! //! ```rust -//! extern crate activitystreams_traits; -//! extern crate activitystreams_types; -//! extern crate serde; -//! #[macro_use] -//! extern crate serde_derive; -//! //! use activitystreams_traits::Object; //! use activitystreams_types::object::properties::ObjectProperties; +//! use serde_derive::{Deserialize, Serialize}; //! //! #[derive(Clone, Debug, Serialize, Deserialize)] //! #[serde(rename_all = "camelCase")] @@ -49,12 +44,12 @@ //! # fn main() {} //! ``` +use activitystreams_derive::Properties; use activitystreams_traits::{Collection, Error, Link, Object, Result}; use chrono::{offset::Utc, DateTime}; -use mime; -use serde_json; +use serde_derive::{Deserialize, Serialize}; -use object::Image; +use crate::object::Image; /// Alias chrono::DateTime for use in derive macros pub type UtcTime = DateTime; diff --git a/src/lib.rs b/src/lib.rs index f1ef18f..58bc11a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,14 +26,8 @@ //! ### Basic //! //! ```rust -//! extern crate activitystreams; -//! extern crate anyhow; -//! extern crate serde; -//! #[macro_use] -//! extern crate serde_derive; -//! extern crate serde_json; -//! //! use activitystreams::{context, Object, Actor, object::Profile}; +//! use serde_derive::{Deserialize, Serialize}; //! //! #[derive(Clone, Debug, Default, Deserialize, Serialize)] //! #[serde(rename_all = "camelCase")] @@ -74,18 +68,10 @@ //! ### Advanced //! //! ```rust -//! #[macro_use] -//! extern crate activitystreams_derive; -//! extern crate activitystreams_traits; -//! extern crate activitystreams_types; -//! extern crate anyhow; -//! extern crate serde; -//! #[macro_use] -//! extern crate serde_derive; -//! extern crate serde_json; -//! +//! use activitystreams_derive::{Properties, UnitString}; //! use activitystreams_traits::{Link, Object}; //! use activitystreams_types::{CustomLink, link::Mention}; +//! use serde_derive::{Deserialize, Serialize}; //! //! /// Using the UnitString derive macro //! /// @@ -136,9 +122,6 @@ //! # } //! ``` -extern crate activitystreams_traits; -extern crate activitystreams_types; - pub mod activity; pub mod actor; pub mod collection;