diff --git a/Cargo.toml b/Cargo.toml index e34159c..0279f32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "activitystreams" description = "Activity Streams in Rust" -version = "0.5.0-alpha.16" +version = "0.5.0-alpha.17" license = "GPL-3.0" authors = ["asonix "] repository = "https://git.asonix.dog/Aardwolf/activitystreams" @@ -17,7 +17,7 @@ primitives = ["chrono", "mime", "serde", "thiserror", "url"] types = ["derive", "kinds", "primitives"] [dependencies] -activitystreams-derive = { version = "0.5.0-alpha.8", path = "activitystreams-derive", optional = true} +activitystreams-derive = { version = "0.5.0-alpha.9", path = "activitystreams-derive", optional = true} chrono = { version = "0.4", optional = true } mime = { version = "0.3", optional = true } serde = { version = "1.0", features = ["derive"], optional = true } diff --git a/README.md b/README.md index 1f57556..849a9a4 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ __A set of Traits and Types that make up the ActivityStreams and ActivityPub spe First, add ActivityStreams to your dependencies ```toml -activitystreams = "0.5.0-alpha.16" +activitystreams = "0.5.0-alpha.17" ``` ### Types @@ -177,7 +177,7 @@ There are a number of features that can be disabled in this crate. By default, e enabled. ```toml -activitystreams = { version = "0.5.0-alpha.16", default-features = "false", features = ["derive"] } +activitystreams = { version = "0.5.0-alpha.17", default-features = "false", features = ["derive"] } ``` | feature | what you get | diff --git a/activitystreams-derive/Cargo.toml b/activitystreams-derive/Cargo.toml index 46bf81c..be9dc04 100644 --- a/activitystreams-derive/Cargo.toml +++ b/activitystreams-derive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "activitystreams-derive" description = "Derive macros for activitystreams" -version = "0.5.0-alpha.8" +version = "0.5.0-alpha.9" license = "GPL-3.0" authors = ["asonix "] repository = "https://git.asonix.dog/Aardwolf/activitystreams" diff --git a/activitystreams-derive/README.md b/activitystreams-derive/README.md index 550907b..2404f2c 100644 --- a/activitystreams-derive/README.md +++ b/activitystreams-derive/README.md @@ -10,7 +10,7 @@ Add the required crates to your `Cargo.toml` ```toml # Cargo.toml -activitystreams = "0.5.0-alpha.16" +activitystreams = "0.5.0-alpha.17" serde = { version = "1.0", features = ["derive"] } ``` diff --git a/activitystreams-derive/src/lib.rs b/activitystreams-derive/src/lib.rs index 7a70fda..7d382d4 100644 --- a/activitystreams-derive/src/lib.rs +++ b/activitystreams-derive/src/lib.rs @@ -23,8 +23,8 @@ //! //! First, add `serde` and `activitystreams-derive` to your Cargo.toml //! ```toml -//! activitystreams-derive = "0.5.0-alpha.8" -//! # or activitystreams = "0.5.0-alpha.16" +//! activitystreams-derive = "0.5.0-alpha.9" +//! # or activitystreams = "0.5.0-alpha.17" //! serde = { version = "1.0", features = ["derive"] } //! ``` //! @@ -269,49 +269,11 @@ pub fn ref_derive(input: TokenStream) -> TokenStream { } } - impl AsRef<#ty> for Ext<#name, U> - where - U: std::fmt::Debug, - { - fn as_ref(&self) -> &#ty { - self.base.as_ref() - } - } - - impl AsRef<#ty> for Ext, V> - where - U: std::fmt::Debug, - V: std::fmt::Debug, - { - fn as_ref(&self) -> &#ty { - self.base.as_ref() - } - } - impl AsMut<#ty> for #name { fn as_mut(&mut self) -> &mut #ty { &mut self.#ident } } - - impl AsMut<#ty> for Ext<#name, U> - where - U: std::fmt::Debug, - { - fn as_mut(&mut self) -> &mut #ty { - self.base.as_mut() - } - } - - impl AsMut<#ty> for Ext, V> - where - U: std::fmt::Debug, - V: std::fmt::Debug, - { - fn as_mut(&mut self) -> &mut #ty { - self.base.as_mut() - } - } } }) .collect(); diff --git a/src/ext.rs b/src/ext.rs index 3454f00..2101ec4 100644 --- a/src/ext.rs +++ b/src/ext.rs @@ -126,10 +126,9 @@ use std::{convert::TryFrom, fmt::Debug}; /// For example, the type `Ext>` will implement the `Object` trait, /// because `Video` implements that trait. /// -/// Additionally, some level of AsRef and AsMut have been derived for Ext. If type type +/// Additionally, AsRef and AsMut have been implemented for Ext. If type type /// `Ext, AnotherType>` exists, that will implement -/// `AsRef` just like the innermost `Follow`. This only works for types -/// two levels deep, however. +/// `AsRef` just like the innermost `Follow`. /// /// Usage: /// ```rust @@ -204,6 +203,26 @@ pub trait Extensible { Self: Sized; } +impl AsRef for Ext +where + T: Base + AsRef, + U: Extension + Debug, +{ + fn as_ref(&self) -> &V { + self.base.as_ref() + } +} + +impl AsMut for Ext +where + T: Base + AsMut, + U: Extension + Debug, +{ + fn as_mut(&mut self) -> &mut V { + self.base.as_mut() + } +} + impl TryFrom> for BaseBox where T: Base + serde::ser::Serialize, diff --git a/src/lib.rs b/src/lib.rs index 2a0ffb4..2c46333 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,7 @@ //! //! First, add ActivityStreams to your dependencies //! ```toml -//! activitystreams = "0.5.0-alpha.16" +//! activitystreams = "0.5.0-alpha.17" //! ``` //! //! ### Types @@ -209,7 +209,7 @@ //! enabled. //! //! ```toml -//! activitystreams = { version = "0.5.0-alpha.16", default-features = "false", features = ["derive"] } +//! activitystreams = { version = "0.5.0-alpha.17", default-features = "false", features = ["derive"] } //! ``` //! //! | feature | what you get | diff --git a/src/link/types.rs b/src/link/types.rs index df8d128..4661acb 100644 --- a/src/link/types.rs +++ b/src/link/types.rs @@ -18,7 +18,6 @@ */ use crate::{ - ext::Ext, link::{kind::*, properties::*, Link, LinkBox}, Base, BaseBox, PropRefs, };