mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2024-11-22 11:51:00 +00:00
Apply anyhow patch from romain@leroux.dev
This commit is contained in:
parent
435de11fe6
commit
0797fb8742
11 changed files with 31 additions and 38 deletions
10
Cargo.toml
10
Cargo.toml
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "activitystreams"
|
||||
description = "Activity Streams in Rust"
|
||||
version = "0.2.4"
|
||||
version = "0.3.0"
|
||||
license = "GPL-3.0"
|
||||
authors = ["asonix <asonix@asonix.dog>"]
|
||||
repository = "https://git.asonix.dog/Aardwolf/activitystreams"
|
||||
|
@ -9,15 +9,15 @@ readme = "README.md"
|
|||
keywords = ["activitystreams", "activitypub"]
|
||||
|
||||
[dependencies]
|
||||
activitystreams-traits = { version = "0.1", path = "activitystreams-traits" }
|
||||
activitystreams-types = { version = "0.2.3", path = "activitystreams-types" }
|
||||
activitystreams-traits = { version = "0.2", path = "activitystreams-traits" }
|
||||
activitystreams-types = { version = "0.3.0", path = "activitystreams-types" }
|
||||
|
||||
[dev-dependencies]
|
||||
failure = "0.1"
|
||||
anyhow = "1.0"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
activitystreams-derive = { version = "0.1", path = "activitystreams-derive" }
|
||||
activitystreams-derive = { version = "0.2", path = "activitystreams-derive" }
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
|
|
12
README.md
12
README.md
|
@ -12,20 +12,19 @@ For basic use, add the following to your Cargo.toml
|
|||
```toml
|
||||
# Cargo.toml
|
||||
|
||||
activitystreams = "0.2"
|
||||
activitystreams = "0.3"
|
||||
```
|
||||
|
||||
And then use it in your project
|
||||
```rust
|
||||
extern crate activitystreams;
|
||||
extern crate failure;
|
||||
extern crate anyhow;
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
|
||||
use activitystreams::{context, Object, Actor, object::Profile};
|
||||
use failure::Error;
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
@ -40,7 +39,7 @@ pub struct Persona {
|
|||
impl Object for Persona {}
|
||||
impl Actor for Persona {}
|
||||
|
||||
fn run() -> Result<(), Error> {
|
||||
fn run() -> Result<(), anyhow::Error> {
|
||||
let mut profile = Profile::default();
|
||||
|
||||
profile.profile.set_describes_object(Persona {
|
||||
|
@ -77,7 +76,7 @@ And then in your project
|
|||
extern crate activitystreams_derive;
|
||||
extern crate activitystreams_traits;
|
||||
extern crate activitystreams_types;
|
||||
extern crate failure;
|
||||
extern crate anyhow;
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
@ -85,7 +84,6 @@ extern crate serde_json;
|
|||
|
||||
use activitystreams_traits::{Link, Object};
|
||||
use activitystreams_types::{CustomLink, link::Mention};
|
||||
use failure::Error;
|
||||
|
||||
/// Using the UnitString derive macro
|
||||
///
|
||||
|
@ -118,7 +116,7 @@ pub struct MyProperties {
|
|||
pub required_key: serde_json::Value,
|
||||
}
|
||||
|
||||
fn run() -> Result<(), Error> {
|
||||
fn run() -> Result<(), anyhow::Error> {
|
||||
let mut props = MyProperties::default();
|
||||
|
||||
props.set_required_key_string("Hey".to_owned())?;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "activitystreams-derive"
|
||||
description = "Derive macros for activitystreams"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
license = "GPL-3.0"
|
||||
authors = ["asonix <asonix.dev@gmail.com>"]
|
||||
repository = "https://git.asonix.dog/Aardwolf/activitystreams"
|
||||
|
@ -14,7 +14,7 @@ syn = "0.13"
|
|||
proc-macro2 = "0.3"
|
||||
|
||||
[dev-dependencies]
|
||||
activitystreams-traits = { version = "0.1", path = "../activitystreams-traits" }
|
||||
activitystreams-traits = { version = "0.2", path = "../activitystreams-traits" }
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
|
|
|
@ -10,8 +10,8 @@ Add the required crates to your `Cargo.toml`
|
|||
```toml
|
||||
# Cargo.toml
|
||||
|
||||
activitystreams-derive = "0.1"
|
||||
activitystreams-traits = "0.1"
|
||||
activitystreams-derive = "0.2"
|
||||
activitystreams-traits = "0.2"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "activitystreams-traits"
|
||||
description = "Traits for ActivityStreams objects"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
license = "GPL-3.0"
|
||||
authors = ["asonix <asonix.dev@gmail.com>"]
|
||||
repository = "https://git.asonix.dog/Aardwolf/activitystreams"
|
||||
|
@ -9,9 +9,9 @@ readme = "README.md"
|
|||
keywords = ["activitystreams", "activitypub"]
|
||||
|
||||
[dependencies]
|
||||
failure = "0.1"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
thiserror = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
serde_derive = "1.0"
|
||||
|
|
|
@ -20,19 +20,19 @@
|
|||
use std::result;
|
||||
|
||||
/// The Error type
|
||||
#[derive(Copy, Clone, Debug, Eq, Fail, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, thiserror::Error)]
|
||||
pub enum Error {
|
||||
/// This error occurs when an Activity Streams type does not contain a requested value
|
||||
#[fail(display = "Key not present")]
|
||||
#[error("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")]
|
||||
#[error("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")]
|
||||
#[error("Failed to serialize data")]
|
||||
Serialize,
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,6 @@
|
|||
//! # fn main() {}
|
||||
//! ```
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure;
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "activitystreams-types"
|
||||
description = "Base types from the Activity Streams spec"
|
||||
version = "0.2.3"
|
||||
version = "0.3.0"
|
||||
license = "GPL-3.0"
|
||||
authors = ["asonix <asonix@asonix.dog>"]
|
||||
repository = "https://git.asonix.dog/Aardwolf/activitystreams"
|
||||
|
@ -9,8 +9,8 @@ readme = "README.md"
|
|||
keywords = ["activitystreams", "activitypub"]
|
||||
|
||||
[dependencies]
|
||||
activitystreams-derive = { version = "0.1", path = "../activitystreams-derive" }
|
||||
activitystreams-traits = { version = "0.1", path = "../activitystreams-traits" }
|
||||
activitystreams-derive = { version = "0.2", path = "../activitystreams-derive" }
|
||||
activitystreams-traits = { version = "0.2", path = "../activitystreams-traits" }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
mime = "0.3"
|
||||
serde = "1.0"
|
||||
|
@ -18,4 +18,4 @@ serde_derive = "1.0"
|
|||
serde_json = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
failure = "0.1"
|
||||
anyhow = "1.0"
|
||||
|
|
|
@ -10,7 +10,7 @@ First, add the crate to your cargo.toml
|
|||
```toml
|
||||
# Cargo.toml
|
||||
|
||||
activitystreams-types = "0.2"
|
||||
activitystreams-types = "0.3"
|
||||
```
|
||||
|
||||
Then use it in your project!
|
||||
|
|
|
@ -24,13 +24,12 @@
|
|||
//! ## Example Usage
|
||||
//! ```rust
|
||||
//! extern crate activitystreams_types;
|
||||
//! extern crate failure;
|
||||
//! extern crate anyhow;
|
||||
//! extern crate serde_json;
|
||||
//!
|
||||
//! use activitystreams_types::{context, link::Mention};
|
||||
//! use failure::Error;
|
||||
//!
|
||||
//! fn run() -> Result<(), Error> {
|
||||
//! fn run() -> Result<(), anyhow::Error> {
|
||||
//! /// A Mention is the only predefined Link type in the Activity Streams spec
|
||||
//! let mut mention = Mention::default();
|
||||
//! mention.link_props.set_context_object(context())?;
|
||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -27,14 +27,13 @@
|
|||
//!
|
||||
//! ```rust
|
||||
//! extern crate activitystreams;
|
||||
//! extern crate failure;
|
||||
//! extern crate anyhow;
|
||||
//! extern crate serde;
|
||||
//! #[macro_use]
|
||||
//! extern crate serde_derive;
|
||||
//! extern crate serde_json;
|
||||
//!
|
||||
//! use activitystreams::{context, Object, Actor, object::Profile};
|
||||
//! use failure::Error;
|
||||
//!
|
||||
//! #[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
//! #[serde(rename_all = "camelCase")]
|
||||
|
@ -49,7 +48,7 @@
|
|||
//! impl Object for Persona {}
|
||||
//! impl Actor for Persona {}
|
||||
//!
|
||||
//! fn run() -> Result<(), Error> {
|
||||
//! fn run() -> Result<(), anyhow::Error> {
|
||||
//! let mut profile = Profile::default();
|
||||
//!
|
||||
//! profile.profile.set_describes_object(Persona {
|
||||
|
@ -79,7 +78,7 @@
|
|||
//! extern crate activitystreams_derive;
|
||||
//! extern crate activitystreams_traits;
|
||||
//! extern crate activitystreams_types;
|
||||
//! extern crate failure;
|
||||
//! extern crate anyhow;
|
||||
//! extern crate serde;
|
||||
//! #[macro_use]
|
||||
//! extern crate serde_derive;
|
||||
|
@ -87,7 +86,6 @@
|
|||
//!
|
||||
//! use activitystreams_traits::{Link, Object};
|
||||
//! use activitystreams_types::{CustomLink, link::Mention};
|
||||
//! use failure::Error;
|
||||
//!
|
||||
//! /// Using the UnitString derive macro
|
||||
//! ///
|
||||
|
@ -120,7 +118,7 @@
|
|||
//! pub required_key: serde_json::Value,
|
||||
//! }
|
||||
//!
|
||||
//! fn run() -> Result<(), Error> {
|
||||
//! fn run() -> Result<(), anyhow::Error> {
|
||||
//! let mut props = MyProperties::default();
|
||||
//!
|
||||
//! props.set_required_key_string("Hey".to_owned())?;
|
||||
|
|
Loading…
Reference in a new issue