diff --git a/examples/actix-jobs-example/src/main.rs b/examples/actix-jobs-example/src/main.rs index 6b63441..ae0e609 100644 --- a/examples/actix-jobs-example/src/main.rs +++ b/examples/actix-jobs-example/src/main.rs @@ -50,44 +50,14 @@ fn main() -> Result<(), Error> { let jobs_actor = builder.build()?; - let jobs = vec![ - MyJobArguments { - some_usize: 0, - other_usize: 1, - }, - MyJobArguments { - some_usize: 1, - other_usize: 2, - }, - MyJobArguments { - some_usize: 3, - other_usize: 5, - }, - MyJobArguments { - some_usize: 8, - other_usize: 13, - }, - MyJobArguments { - some_usize: 21, - other_usize: 34, - }, - MyJobArguments { - some_usize: 55, - other_usize: 89, - }, - MyJobArguments { - some_usize: 144, - other_usize: 233, - }, - MyJobArguments { - some_usize: 377, - other_usize: 610, - }, - MyJobArguments { - some_usize: 987, - other_usize: 1597, - }, - ]; + let (_, _, jobs) = (1..18).fold((0, 1, Vec::new()), |(x, y, mut acc), _| { + acc.push(MyJobArguments { + some_usize: x, + other_usize: y, + }); + + (y, x + y, acc) + }); for job in jobs { jobs_actor.do_send(QueueJob(MyProcessor::new_job(job, None, None)?)); diff --git a/examples/tokio-jobs-example/src/main.rs b/examples/tokio-jobs-example/src/main.rs index c77b907..e9826c1 100644 --- a/examples/tokio-jobs-example/src/main.rs +++ b/examples/tokio-jobs-example/src/main.rs @@ -53,44 +53,14 @@ fn main() { let handle = runner.spawn(); - let jobs = vec![ - MyJobArguments { - some_usize: 0, - other_usize: 1, - }, - MyJobArguments { - some_usize: 1, - other_usize: 2, - }, - MyJobArguments { - some_usize: 3, - other_usize: 5, - }, - MyJobArguments { - some_usize: 8, - other_usize: 13, - }, - MyJobArguments { - some_usize: 21, - other_usize: 34, - }, - MyJobArguments { - some_usize: 55, - other_usize: 89, - }, - MyJobArguments { - some_usize: 144, - other_usize: 233, - }, - MyJobArguments { - some_usize: 377, - other_usize: 610, - }, - MyJobArguments { - some_usize: 987, - other_usize: 1597, - }, - ]; + let (_, _, jobs) = (1..18).fold((0, 1, Vec::new()), |(x, y, mut acc), _| { + acc.push(MyJobArguments { + some_usize: x, + other_usize: y, + }); + + (y, x + y, acc) + }); for job in jobs { tokio::spawn(