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
112
113
114
115
116
117
118
119
120
121
122
//! Options for encoding and decoding stringcue blobs.
//!
//! Blobs are always padded with `1` bits up to the next byte boundary after
//! the final encoded codepoint (and terminator); there is no alignment
//! option.
/// Whether a `CONTROL` terminator is appended to the encoded blob, and how
/// empty elements are treated.
///
/// The terminator is a single `CONTROL` for `encode` and two consecutive
/// `CONTROL`s for `encode_all`. Empty elements encode to *zero* codepoints
/// between consecutive separators, i.e. also to consecutive `CONTROL`s, so
/// they are only representable without an in-band terminator.
/// Treatment of empty elements by `encode_all`.
///
/// With [`EncodeTerminator::Write`], empty elements are unrepresentable and
/// therefore dropped, and [`EncodeTerminator::Omit`] is the only place they
/// can be configured.
/// Whether a `CONTROL` terminator is required, tolerated or refused when
/// decoding a blob, and how empty elements are read without one.
///
/// The terminator is a single `CONTROL` at the end of a `decode` blob and
/// two consecutive `CONTROL`s at the end of a `decode_all` blob. Consecutive
/// `CONTROL`s are only meaningful as empty elements, so
/// [`DecodeTerminator::Refuse`] is the only variant that can read them:
/// with [`DecodeTerminator::Require`] or [`DecodeTerminator::Tolerate`], a
/// terminator at the end of a blob is indistinguishable from a trailing
/// empty element.
/// Treatment of empty elements by `decode_all`.
///
/// Only meaningful with [`DecodeTerminator::Refuse`]; with
/// [`DecodeTerminator::Require`] or [`DecodeTerminator::Tolerate`], empty
/// elements are indistinguishable from a terminator.
/// Options for encoding; see [`crate::encode`] and [`crate::encode_all`].
///
/// Defaults: write no `CONTROL` terminator to the
/// output and drop empty elements instead of encoding them.
/// Options for decoding; see [`crate::decode`] and [`crate::decode_all`].
///
/// Defaults: accept a superfluous terminator on input.