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
use crateFactory;
use Result;
/// A transactional boundary for domain mutation.
///
/// `UnitOfWork` represents a scoped, transactional unit in which domain
/// operations (such as command handling) are performed. It ensures that
/// all changes made during its lifetime are either committed atomically
/// or rolled back on failure.
///
/// Any events produced during the unit of work should be captured using
/// `capture_event`. These events will be published only if the unit of
/// work is successfully committed.