Fix example in readme

This commit is contained in:
asonix 2020-07-26 12:19:07 -05:00
parent 7dad81d2f3
commit 8e81b9edb2
2 changed files with 6 additions and 9 deletions

View file

@ -1,4 +1,5 @@
# Unreleased
Fix example in readme
# 0.1.0-alpha.2
Fix docs

View file

@ -17,15 +17,15 @@ activitystreams-ext = "0.1.0-alpha.2"
For an example, we'll implement a PublicKey extension and demonstrate usage with Ext1
```rust
use activitystreams_ext::{Ext1, UnparsedExtension};
use activitystreams::{
actor::{ApActor, Person},
context,
prelude::*,
primitives::XsdAnyUri,
security,
unparsed::UnparsedMutExt,
url::Url,
};
use activitystreams_ext::{Ext1, UnparsedExtension};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
@ -36,8 +36,8 @@ pub struct PublicKey {
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PublicKeyInner {
id: XsdAnyUri,
owner: XsdAnyUri,
id: Url,
owner: Url,
public_key_pem: String,
}
@ -62,11 +62,7 @@ where
pub type ExtendedPerson = Ext1<ApActor<Person>, PublicKey>;
fn main() -> Result<(), anyhow::Error> {
let actor = ApActor::new(
"http://in.box".parse()?,
"http://out.box".parse()?,
Person::new(),
);
let actor = ApActor::new("http://in.box".parse()?, Person::new());
let mut person = Ext1::new(
actor,