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/mod.rs | |
parent | 33c5c21a576668f5eaf7d9fafb504f51a3331593 (diff) |
Use an associated type instead of Generic.
Diffstat (limited to 'server/src/apub/mod.rs')
-rw-r--r-- | server/src/apub/mod.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/server/src/apub/mod.rs b/server/src/apub/mod.rs index d691e839..05792968 100644 --- a/server/src/apub/mod.rs +++ b/server/src/apub/mod.rs @@ -126,12 +126,14 @@ fn is_apub_id_valid(apub_id: &Url) -> bool { } // TODO Not sure good names for these -pub trait ToApub<Response> { - fn to_apub(&self, conn: &PgConnection) -> Result<Response, Error>; +pub trait ToApub { + type Response; + fn to_apub(&self, conn: &PgConnection) -> Result<Self::Response, Error>; } -pub trait FromApub<ApubType> { - fn from_apub(apub: &ApubType, conn: &PgConnection) -> Result<Self, Error> +pub trait FromApub { + type ApubType; + fn from_apub(apub: &Self::ApubType, conn: &PgConnection) -> Result<Self, Error> where Self: Sized; } |