diff --git a/examples/local_federation/objects/post.rs b/examples/local_federation/objects/post.rs index 2cca41d..800027e 100644 --- a/examples/local_federation/objects/post.rs +++ b/examples/local_federation/objects/post.rs @@ -19,7 +19,7 @@ pub struct DbPost { impl DbPost { pub fn new(text: String, creator: ObjectId) -> Result { - let ap_id = generate_object_id(creator.inner().domain())?.try_into()?; + let ap_id = generate_object_id(creator.inner().domain())?.into(); Ok(DbPost { text, ap_id, diff --git a/examples/local_federation/utils.rs b/examples/local_federation/utils.rs index 6b5f9d0..d61d658 100644 --- a/examples/local_federation/utils.rs +++ b/examples/local_federation/utils.rs @@ -1,5 +1,8 @@ +use std::str::FromStr; + +use activitypub_federation::url::Url; use rand::{distributions::Alphanumeric, thread_rng, Rng}; -use url::{ParseError, Url}; +use url::ParseError; /// Just generate random url as object id. In a real project, you probably want to use /// an url which contains the database id for easy retrieval (or store the random id in db). @@ -9,5 +12,5 @@ pub fn generate_object_id(domain: &str) -> Result { .take(7) .map(char::from) .collect(); - Url::parse(&format!("http://{}/objects/{}", domain, id)) + Url::from_str(&format!("http://{}/objects/{}", domain, id)) }