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
use BuildHasherDefault;
use HashMap;
pub type ReplicaIdMap<T> =
;
pub type ReplicaIdMapValuesMut<'a, T> =
ValuesMut;
/// A unique identifier for a [`Replica`](crate::Replica).
///
/// It's very important that all [`Replica`](crate::Replica)s in the same
/// collaborative session have unique [`ReplicaId`]s as this type is used to
/// distinguish between them when integrating remote edits.
///
/// Guaranteeing uniqueness is up to you.
///
/// If your editing session is not proxied through a server you control you can
/// generate a random `u64` every time a new [`Replica`](crate::Replica) is
/// created and be reasonably sure[^collisions] that there won't be any
/// collisions.
///
/// [^collisions]: you'd have to have almost [200k peers][table] in the same
/// editing session to reach a one-in-a-billion chance of a single collision,
/// which is more than good enough for the kind of use cases this library is
/// designed for.
///
/// [table]: https://en.wikipedia.org/wiki/Birthday_problem#Probability_table
pub type ReplicaId = u64;
;