example types: impl From<Url> for ObjectId
This commit is contained in:
parent
6a7acbcb44
commit
365fdcfc75
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue