mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2025-02-19 15:06:19 +00:00
Make Ext<> work in Boxtypes
This commit is contained in:
parent
5cb6b27a61
commit
2f27ef3f70
6 changed files with 33 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "activitystreams"
|
name = "activitystreams"
|
||||||
description = "Activity Streams in Rust"
|
description = "Activity Streams in Rust"
|
||||||
version = "0.5.0-alpha.11"
|
version = "0.5.0-alpha.12"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
repository = "https://git.asonix.dog/Aardwolf/activitystreams"
|
repository = "https://git.asonix.dog/Aardwolf/activitystreams"
|
||||||
|
@ -17,7 +17,7 @@ primitives = ["chrono", "mime", "serde", "thiserror", "url"]
|
||||||
types = ["derive", "kinds", "primitives"]
|
types = ["derive", "kinds", "primitives"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
activitystreams-derive = { version = "0.5.0-alpha.4", path = "activitystreams-derive", optional = true}
|
activitystreams-derive = { version = "0.5.0-alpha.5", path = "activitystreams-derive", optional = true}
|
||||||
chrono = { version = "0.4", optional = true }
|
chrono = { version = "0.4", optional = true }
|
||||||
mime = { version = "0.3", optional = true }
|
mime = { version = "0.3", optional = true }
|
||||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||||
|
|
|
@ -9,7 +9,7 @@ __A set of Traits and Types that make up the ActivityStreams and ActivityPub spe
|
||||||
|
|
||||||
First, add ActivityStreams to your dependencies
|
First, add ActivityStreams to your dependencies
|
||||||
```toml
|
```toml
|
||||||
activitystreams = "0.5.0-alpha.11"
|
activitystreams = "0.5.0-alpha.12"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Types
|
### Types
|
||||||
|
@ -177,7 +177,7 @@ There are a number of features that can be disabled in this crate. By default, e
|
||||||
enabled.
|
enabled.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
activitystreams = { version = "0.5.0-alpha.11", default-features = "false", features = ["derive"] }
|
activitystreams = { version = "0.5.0-alpha.12", default-features = "false", features = ["derive"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
| feature | what you get |
|
| feature | what you get |
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "activitystreams-derive"
|
name = "activitystreams-derive"
|
||||||
description = "Derive macros for activitystreams"
|
description = "Derive macros for activitystreams"
|
||||||
version = "0.5.0-alpha.4"
|
version = "0.5.0-alpha.5"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = ["asonix <asonix.dev@gmail.com>"]
|
authors = ["asonix <asonix.dev@gmail.com>"]
|
||||||
repository = "https://git.asonix.dog/Aardwolf/activitystreams"
|
repository = "https://git.asonix.dog/Aardwolf/activitystreams"
|
||||||
|
|
|
@ -10,7 +10,7 @@ Add the required crates to your `Cargo.toml`
|
||||||
```toml
|
```toml
|
||||||
# Cargo.toml
|
# Cargo.toml
|
||||||
|
|
||||||
activitystreams = "0.5.0-alpha.4"
|
activitystreams = "0.5.0-alpha.12"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
//!
|
//!
|
||||||
//! First, add `serde` and `activitystreams-derive` to your Cargo.toml
|
//! First, add `serde` and `activitystreams-derive` to your Cargo.toml
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! activitystreams-derive = "0.5.0-alpha.4"
|
//! activitystreams-derive = "0.5.0-alpha.5"
|
||||||
//! # or activitystreams = "0.5.0-alpha.9"
|
//! # or activitystreams = "0.5.0-alpha.12"
|
||||||
//! serde = { version = "1.0", features = ["derive"] }
|
//! serde = { version = "1.0", features = ["derive"] }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
@ -239,6 +239,29 @@ pub fn ref_derive(input: TokenStream) -> TokenStream {
|
||||||
#box_name::from_concrete(s)
|
#box_name::from_concrete(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T> std::convert::TryFrom<Ext<#name, T>> for #box_name
|
||||||
|
where
|
||||||
|
T: serde::de::DeserializeOwned + serde::ser::Serialize + std::fmt::Debug,
|
||||||
|
{
|
||||||
|
type Error = std::io::Error;
|
||||||
|
|
||||||
|
fn try_from(s: Ext<#name, T>) -> Result<Self, Self::Error> {
|
||||||
|
#box_name::from_concrete(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T, U> std::convert::TryFrom<Ext<Ext<#name, T>, U>> for #box_name
|
||||||
|
where
|
||||||
|
T: serde::de::DeserializeOwned + serde::ser::Serialize + std::fmt::Debug,
|
||||||
|
U: serde::de::DeserializeOwned + serde::ser::Serialize + std::fmt::Debug,
|
||||||
|
{
|
||||||
|
type Error = std::io::Error;
|
||||||
|
|
||||||
|
fn try_from(s: Ext<Ext<#name, T>, U>) -> Result<Self, Self::Error> {
|
||||||
|
#box_name::from_concrete(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
//!
|
//!
|
||||||
//! First, add ActivityStreams to your dependencies
|
//! First, add ActivityStreams to your dependencies
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! activitystreams = "0.5.0-alpha.11"
|
//! activitystreams = "0.5.0-alpha.12"
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ### Types
|
//! ### Types
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
//! enabled.
|
//! enabled.
|
||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! activitystreams = { version = "0.5.0-alpha.11", default-features = "false", features = ["derive"] }
|
//! activitystreams = { version = "0.5.0-alpha.12", default-features = "false", features = ["derive"] }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! | feature | what you get |
|
//! | feature | what you get |
|
||||||
|
|
Loading…
Reference in a new issue