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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
pub use Publicity;
/// What happens to a client's view of an entity when it leaves their scope.
///
/// Scope is lost when either the entity or the user is removed from a shared
/// room, or when a [`UserScopeMut`] explicitly excludes the entity.
///
/// [`UserScopeMut`]: crate::UserScopeMut
/// Replication configuration for a server entity.
///
/// Two orthogonal axes govern how the entity behaves on connected clients:
///
/// - [`publicity`](ReplicationConfig::publicity) — controls *who* can see or
/// mutate the entity. See [`Publicity`] for the full state machine.
/// - [`scope_exit`](ReplicationConfig::scope_exit) — controls what happens on
/// a client when the entity leaves that user's scope. See [`ScopeExit`].
///
/// Use the const constructors [`public`](ReplicationConfig::public),
/// [`private`](ReplicationConfig::private), and
/// [`delegated`](ReplicationConfig::delegated) as starting points, then chain
/// [`persist_on_scope_exit`](ReplicationConfig::persist_on_scope_exit) to
/// override the scope-exit behaviour.
///
/// # Examples
///
/// ```rust
/// # use naia_server::ReplicationConfig;
/// // Public entity that persists in scope when temporarily out of view:
/// let cfg = ReplicationConfig::public().persist_on_scope_exit();
///
/// // Delegated entity with default (despawn) scope-exit:
/// let cfg = ReplicationConfig::delegated();
/// ```