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 crateDocActorResult;
/// Result of a document operation that includes both the closure result and any side effects.
///
/// When modifying a document via `with_document`, the operation may generate side effects
/// like storage operations (saving changes) or messages to be sent to connected peers.
/// This type encapsulates both the result of the user's closure and the side effects
/// that need to be executed.
///
/// # Type Parameters
///
/// * `T` - The type returned by the closure passed to `with_document`
///
/// # Example
///
/// ```text
/// let result = actor.with_document(|doc| {
/// // Modify document and return some value
/// doc.put_object(automerge::ROOT, "key", "value").unwrap()
/// })?;
///
/// // Access the closure result
/// let object_id = result.value;
///
/// // Execute any side effects
/// for io_task in result.actor_result.io_tasks {
/// // Execute storage operations
/// }
/// for message in result.actor_result.outgoing_messages {
/// // Send messages to main Samod
/// }
/// ```