1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
use fmt;
use ops;
/// Data that can be extracted from JSON encoded job variables in [`auto handler`]s.
///
/// [`auto handler`]: crate::JobWorkerBuilder::with_auto_handler
///
/// # Examples
///
/// ```no_run
/// use futures::future;
/// use serde::{Deserialize, Serialize};
/// use std::cell::Cell;
/// use thiserror::Error;
/// use zeebe::{Client, Data};
///
/// #[derive(Error, Debug)]
/// enum MyError {}
///
/// #[derive(Serialize)]
/// struct MyJobResult {
/// result: u32,
/// }
///
/// #[derive(Deserialize)]
/// struct MyJobData {
/// some_key: String,
/// }
///
/// # #[tokio::main]
/// # async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let client = Client::default();
///
/// let _job = client
/// .job_worker()
/// .with_job_type("my-job-type")
/// .with_auto_handler(|my_job_data: Data<MyJobData>| {
/// future::ok::<_, MyError>(MyJobResult { result: 42 })
/// })
/// .run()
/// .await?;
/// # Ok(())
/// # }
/// ```
;