diff options
author | Dessalines <tyhou13@gmx.com> | 2020-04-24 17:30:27 -0400 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-04-24 17:30:27 -0400 |
commit | 8a25f0f8165604955933b84c81d5134a80a03e4e (patch) | |
tree | ece4c4c79afa9b9309fbf574c506939729078218 /server/src/apub/post.rs | |
parent | 33c5c21a576668f5eaf7d9fafb504f51a3331593 (diff) |
Use an associated type instead of Generic.
Diffstat (limited to 'server/src/apub/post.rs')
-rw-r--r-- | server/src/apub/post.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/server/src/apub/post.rs b/server/src/apub/post.rs index 7ad4394d..51ba861e 100644 --- a/server/src/apub/post.rs +++ b/server/src/apub/post.rs @@ -15,7 +15,9 @@ pub async fn get_apub_post( Ok(create_apub_response(&post.to_apub(&db.get().unwrap())?)) } -impl ToApub<Page> for Post { +impl ToApub for Post { + type Response = Page; + // Turn a Lemmy post into an ActivityPub page that can be sent out over the network. fn to_apub(&self, conn: &PgConnection) -> Result<Page, Error> { let mut page = Page::default(); @@ -53,7 +55,9 @@ impl ToApub<Page> for Post { } } -impl FromApub<Page> for PostForm { +impl FromApub for PostForm { + type ApubType = Page; + /// Parse an ActivityPub page received from another instance into a Lemmy post. fn from_apub(page: &Page, conn: &PgConnection) -> Result<PostForm, Error> { let oprops = &page.object_props; |