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
//! # Snurr
//!
//! `Snurr` can run the process flow from a BPMN 2.0 file created by <https://demo.bpmn.io/new>.
//!
//! - Add your own behavior with Rust code from a small API. The wiring is already setup from the file.
//! - Change the BPMN diagram with new Task and Gateways without the need to refactor your old code.
//! - Scaffold the initial BPMN diagram so you don't have to do the boilerplate code.
//! - Contains no database.
//! - Single or multithreaded (opt in)
//!
//! This is not a complete implementation of the BPMN 2.0 specification but intend to be a light weight subset of it.
//!
//! ## Example
//!
//! ### Cargo.toml
//! ```toml
//! [dependencies]
//! snurr = "0.6"
//! log = "0.4"
//! pretty_env_logger = "0.5"
//! ```
//! ### main.rs
//!
//! ```
//! use snurr::{Eventhandler, Process};
//!
//! extern crate pretty_env_logger;
//!
//! #[derive(Debug, Default)]
//! struct Counter {
//! count: u32,
//! }
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! pretty_env_logger::init();
//!
//! // Create process from BPMN file
//! let bpmn = Process::new("examples/example.bpmn")?;
//!
//! // Create Eventhandler with struct type
//! let mut handler: Eventhandler<Counter> = Eventhandler::default();
//!
//! // Register task function for handler.
//! handler.add_task("Count 1", |input| {
//! input.lock().unwrap().count += 1;
//! None
//! });
//!
//! // Register gateway function for handler.
//! handler.add_gateway("equal to 3", |input| {
//! let result = if input.lock().unwrap().count == 3 {
//! "YES"
//! } else {
//! "NO"
//! };
//! result.into()
//! });
//!
//! // Run the process with handler and data
//! let pr = bpmn.run(&handler, Counter::default())?;
//!
//! // Print the result.
//! println!("Result: {:?}", pr.result);
//! Ok(())
//! }
//! ```
pub use ;
pub use ;
pub use ;