example types: impl From<Url> for ObjectId

This commit is contained in:
Aode (lion) 2021-11-19 14:51:57 -06:00
parent 6a7acbcb44
commit 365fdcfc75

View file

@ -19,7 +19,7 @@ where
ObjectId(apub_core::object_id::ObjectId::new(id))
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub enum NoteType {
Note,
}
@ -54,6 +54,15 @@ impl<Kind> Display for ObjectId<Kind> {
}
}
impl<Kind> From<Url> for ObjectId<Kind>
where
Self: Dereference,
{
fn from(url: Url) -> Self {
object_id::<Kind>(url)
}
}
impl Dereference for ObjectId<NoteType> {
type Output = Note;