From db12d38f15b155bfaae1168124954edef6d32d0f Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 20 Mar 2020 22:13:30 -0500 Subject: [PATCH] Fix example --- jobs-core/src/processor.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/jobs-core/src/processor.rs b/jobs-core/src/processor.rs index 85b90c4..baa62e5 100644 --- a/jobs-core/src/processor.rs +++ b/jobs-core/src/processor.rs @@ -22,26 +22,23 @@ use std::{future::Future, pin::Pin}; /// /// ```rust /// use anyhow::Error; -/// use background_jobs_core::{Backoff, Job, MaxRetries, Processor}; -/// use futures::future::{ok, Ready}; +/// use background_jobs_core::{Job, Processor}; /// use log::info; -/// use serde_derive::{Deserialize, Serialize}; -/// use std::future::Future; /// -/// #[derive(Deserialize, Serialize)] +/// #[derive(serde::Deserialize, serde::Serialize)] /// struct MyJob { /// count: i32, /// } /// +/// #[async_trait::async_trait] /// impl Job for MyJob { /// type Processor = MyProcessor; /// type State = (); -/// type Future = Ready>; /// -/// fn run(self, _state: Self::State) -> Self::Future { +/// async fn run(self, _state: Self::State) -> Result<(), Error> { /// info!("Processing {}", self.count); /// -/// ok(()) +/// Ok(()) /// } /// } /// @@ -53,8 +50,6 @@ use std::{future::Future, pin::Pin}; /// /// const NAME: &'static str = "IncrementProcessor"; /// const QUEUE: &'static str = "default"; -/// const MAX_RETRIES: MaxRetries = MaxRetries::Count(1); -/// const BACKOFF_STRATEGY: Backoff = Backoff::Exponential(2); /// } /// /// fn main() -> Result<(), Error> {