mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2024-11-24 21:01:00 +00:00
Fix example in readme
This commit is contained in:
parent
7dad81d2f3
commit
8e81b9edb2
2 changed files with 6 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
Fix example in readme
|
||||||
|
|
||||||
# 0.1.0-alpha.2
|
# 0.1.0-alpha.2
|
||||||
Fix docs
|
Fix docs
|
||||||
|
|
|
@ -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
|
For an example, we'll implement a PublicKey extension and demonstrate usage with Ext1
|
||||||
```rust
|
```rust
|
||||||
use activitystreams_ext::{Ext1, UnparsedExtension};
|
|
||||||
use activitystreams::{
|
use activitystreams::{
|
||||||
actor::{ApActor, Person},
|
actor::{ApActor, Person},
|
||||||
context,
|
context,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
primitives::XsdAnyUri,
|
|
||||||
security,
|
security,
|
||||||
unparsed::UnparsedMutExt,
|
unparsed::UnparsedMutExt,
|
||||||
|
url::Url,
|
||||||
};
|
};
|
||||||
|
use activitystreams_ext::{Ext1, UnparsedExtension};
|
||||||
|
|
||||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
|
@ -36,8 +36,8 @@ pub struct PublicKey {
|
||||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct PublicKeyInner {
|
pub struct PublicKeyInner {
|
||||||
id: XsdAnyUri,
|
id: Url,
|
||||||
owner: XsdAnyUri,
|
owner: Url,
|
||||||
public_key_pem: String,
|
public_key_pem: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,11 +62,7 @@ where
|
||||||
pub type ExtendedPerson = Ext1<ApActor<Person>, PublicKey>;
|
pub type ExtendedPerson = Ext1<ApActor<Person>, PublicKey>;
|
||||||
|
|
||||||
fn main() -> Result<(), anyhow::Error> {
|
fn main() -> Result<(), anyhow::Error> {
|
||||||
let actor = ApActor::new(
|
let actor = ApActor::new("http://in.box".parse()?, Person::new());
|
||||||
"http://in.box".parse()?,
|
|
||||||
"http://out.box".parse()?,
|
|
||||||
Person::new(),
|
|
||||||
);
|
|
||||||
|
|
||||||
let mut person = Ext1::new(
|
let mut person = Ext1::new(
|
||||||
actor,
|
actor,
|
||||||
|
|
Loading…
Reference in a new issue