From 6abdbb5597129aa89f143294ba8c9c977452d345 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 6 Nov 2017 13:08:24 -0500 Subject: [PATCH] associated types ftw thanks gustav --- ofborg/src/bin/builder.rs | 4 +++- ofborg/src/worker.rs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ofborg/src/bin/builder.rs b/ofborg/src/bin/builder.rs index 59e1797..18b1308 100644 --- a/ofborg/src/bin/builder.rs +++ b/ofborg/src/bin/builder.rs @@ -60,7 +60,9 @@ struct BuildWorker { } impl worker::SimpleWorker for BuildWorker { - fn consumer(&self, job: BuildJob, resp: Actions) -> Result<(), Error> { + type J = BuildJob; + + fn consumer(&self, job: BuildJob, resp: Actions) -> Result<(), Error> { let project = self.cloner.project(job.repo.full_name, job.repo.clone_url); let co = project.clone_for("builder".to_string(), job.pr.number.to_string())?; diff --git a/ofborg/src/worker.rs b/ofborg/src/worker.rs index f3586c8..d7ce25d 100644 --- a/ofborg/src/worker.rs +++ b/ofborg/src/worker.rs @@ -23,7 +23,8 @@ pub struct Actions { } pub trait SimpleWorker { - fn consumer(&self, job: J, resp: Actions) -> Result<(), Error>; + type J; + fn consumer(&self, job: Self::J, resp: Actions) -> Result<(), Error>; } pub fn new(worker: T) -> Worker {