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
//! Ordered operations for changing an in-memory process context.
use crateContextValue;
use crateContextPatchBuilder;
use crateIdField;
/// Ordered changes applied to an in-memory `ContextMap`.
///
/// Queued handler patches persist ordered sets and removals atomically.
/// The low-level context map writer remains a merge operation.
///
/// # Examples
///
/// ```
/// use fluxpro_engine::models::context_map::context_map::ContextMap;
/// use fluxpro_engine::models::context_map::context_patcher::ContextPatcher;
/// use fluxpro_engine::models::id_field::IdField;
///
/// let approved = IdField::new("approved").unwrap();
/// let patch = ContextPatcher::builder()
/// .set_bool(approved.clone(), false)
/// .set_bool(approved.clone(), true)
/// .build();
/// let mut context = ContextMap::default();
/// context.apply_patcher(&patch);
/// assert_eq!(context.as_bool(&approved), Some(true));
/// ```
/// One ordered context mutation; later operations on the same key win.