mirror of
https://git.asonix.dog/asonix/activitystreams.git
synced 2024-11-22 03:40:59 +00:00
Update basic example to use Ext
This commit is contained in:
parent
a7263164d8
commit
8edf20bcd0
1 changed files with 6 additions and 3 deletions
|
@ -1,7 +1,10 @@
|
||||||
use activitystreams::object::Video;
|
use activitystreams::{
|
||||||
|
ext::Ext,
|
||||||
|
object::{properties::ApObjectProperties, Video},
|
||||||
|
};
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut v = Video::default();
|
let mut v = Video::full();
|
||||||
|
|
||||||
v.as_mut()
|
v.as_mut()
|
||||||
.set_context_xsd_any_uri("https://www.w3.org/ns/activitystreams")?
|
.set_context_xsd_any_uri("https://www.w3.org/ns/activitystreams")?
|
||||||
|
@ -18,7 +21,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
|
||||||
println!("json, {}", s);
|
println!("json, {}", s);
|
||||||
|
|
||||||
let v: Video = serde_json::from_str(&s)?;
|
let v: Ext<Video, ApObjectProperties> = serde_json::from_str(&s)?;
|
||||||
|
|
||||||
println!("Video again, {:#?}", v);
|
println!("Video again, {:#?}", v);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue