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
use fmt;
/// The Apache TinkerPop `Cardinality` token: how a vertex property write treats values that
/// already exist under the same key.
///
/// `Cardinality::Single` replaces the existing value(s), `Cardinality::List` appends another
/// value, `Cardinality::Set` appends a value only if it is not present yet. Graphersal stores one
/// value per vertex property key, so only `Single` can be honoured by writes; `List`/`Set` are
/// accepted tokens that fail with a clear error where a write would need them.
///
/// In the Rhai DSL: `Cardinality.single` / `Cardinality.list` / `Cardinality.set` (or
/// `Cardinality::single` ...); `Cardinality.single(v)` wraps a value with a cardinality for
/// `mergeV()` option maps.
///
/// ```rust
/// use graphersal::prelude::Cardinality;
///
/// assert_eq!(Cardinality::Single.to_string(), "single");
/// assert_ne!(Cardinality::List, Cardinality::Set);
/// ```
///
/// Closed set, so deliberately not `#[non_exhaustive]`: TinkerPop's property model defines exactly
/// these three cardinalities.