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
/*!
Flatten nested values when streaming.
This library is like the standard library's `Iterator::flatten` method, but for `sval::Stream`s.
Given a value, it will flatten its nested values onto a parent structure. It supports flattening
any combination of map, sequence, record, or tuple onto any other.
If you're using `sval_derive`, you can use the `#[flatten]` attribute on a field.
# Specifics
Flattening unwraps containers and translates their values into the form needed by their parent.
The following types can be flattened:
- maps
- sequences
- records
- tuples
Any other type, including primitives like tags, booleans, and text will be ignored if flattened.
## Maps
- **maps**: keys are passed through directly, even if they're complex values like other maps.
- **sequences**: keys are the stringified offset of sequence values.
- **records**: keys are the label of record values.
- **tuples**: keys are the stringified index of tuple values.
## Sequences
- **maps**: map keys are ignored; only map values are flattened.
- **sequences**: sequence values are passed through directly.
- **records**: record values are passed through directly.
- **tuples**: tuple values are passed through directly.
## Records
- **maps**: map keys are stringified into labels. For complex values like other maps each nested
value is stringified and concatenated together.
- **sequences**: labels are the stringified offset of sequence values.
- **records**: labels are passed through directly.
- **tuples**: labels are the stringified index of tuple values.
## Tuples
- **maps**: map keys are ignored; only map values are flattened.
- **sequences**: indexes are the offset of sequence values.
- **records**: indexes are the offset of record values.
- **tuples**: tuple values are passed through directly.
*/
extern crate alloc;
pub use ;