Debian Codegraph @

src/parse.rs

raw symbols SCIP
1 #![allow(clippy::identity_op)]
2
3 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::{
4 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!,
5 stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::{Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#},
6 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#,
7 };
8 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{
9 charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/::from_u32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/from_u32(). as char_from_u32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/from_u32().,
10 strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/::{selfrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/, from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8()., FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#, Utf8Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/error/Utf8Error#},
11 };
12
13 use unicode_identrust-analyzer cargo unicode-ident 1.0.0 crate/::{is_xid_continuerust-analyzer cargo unicode-ident 1.0.0 is_xid_continue()., is_xid_startrust-analyzer cargo unicode-ident 1.0.0 is_xid_start().};
14
15 use craterust-analyzer cargo ron 0.12.0 crate/::{
16 errorrust-analyzer cargo ron 0.12.0 error/::{Errorrust-analyzer cargo ron 0.12.0 error/Error#, Positionrust-analyzer cargo ron 0.12.0 error/Position#, Resultrust-analyzer cargo ron 0.12.0 error/Result#, Spanrust-analyzer cargo ron 0.12.0 error/Span#, SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError#, SpannedResultrust-analyzer cargo ron 0.12.0 error/SpannedResult#},
17 extensionsrust-analyzer cargo ron 0.12.0 extensions/::Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#,
18 valuerust-analyzer cargo ron 0.12.0 value/::Numberrust-analyzer cargo ron 0.12.0 value/number/Number#,
19 };
20
21 const fn is_int_charrust-analyzer cargo ron 0.12.0 parse/is_int_char().(c: char) -> bool {
22 c.is_ascii_hexdigitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_ascii_hexdigit().() || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'_'
23 }
24
25 const fn is_float_charrust-analyzer cargo ron 0.12.0 parse/is_float_char().(c: char) -> bool {
26 c.is_ascii_digitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_ascii_digit().() || matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(c, 'e' | 'E' | '.' | '+' | '-' | '_')
27 }
28
29 pub fn is_ident_first_charrust-analyzer cargo ron 0.12.0 parse/is_ident_first_char().(c: char) -> bool {
30 c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'_' || is_xid_startrust-analyzer cargo unicode-ident 1.0.0 is_xid_start().(c)
31 }
32
33 pub fn is_ident_raw_charrust-analyzer cargo ron 0.12.0 parse/is_ident_raw_char().(c: char) -> bool {
34 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(c, '.' | '+' | '-') rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitOr<Self>`]bitor().is_xid_continuerust-analyzer cargo unicode-ident 1.0.0 is_xid_continue().(c)
35 }
36
37 pub const fn is_whitespace_charrust-analyzer cargo ron 0.12.0 parse/is_whitespace_char().(c: char) -> bool {
38 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(
39 c,
40 ' ' | '\t'
41 | '\n'
42 | '\r'
43 | '\x0B'
44 | '\x0C'
45 | '\u{85}'
46 | '\u{200E}'
47 | '\u{200F}'
48 | '\u{2028}'
49 | '\u{2029}'
50 )
51 }
52
53 #[cfg(feature = "integer128")]
54 pub(craterust-analyzer cargo ron 0.12.0 crate/) type LargeUIntrust-analyzer cargo ron 0.12.0 parse/LargeUInt# = u128;
55 #[cfg(not(feature = "integer128"))]
56 pub(craterust-analyzer cargo ron 0.12.0 crate/) type LargeUInt = u64;
57 #[cfg(feature = "integer128")]
58 pub(craterust-analyzer cargo ron 0.12.0 crate/) type LargeSIntrust-analyzer cargo ron 0.12.0 parse/LargeSInt# = i128;
59 #[cfg(not(feature = "integer128"))]
60 pub(craterust-analyzer cargo ron 0.12.0 crate/) type LargeSInt = i64;
61
62 pub struct Parserrust-analyzer cargo ron 0.12.0 parse/Parser#<'a> {
63 /// Bits set according to the [`Extensions`] enum.
64 pub extsrust-analyzer cargo ron 0.12.0 parse/Parser#exts.: Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#,
65 srcrust-analyzer cargo ron 0.12.0 parse/Parser#src.: &'a str,
66 cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.: ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#,
67 prev_cursorrust-analyzer cargo ron 0.12.0 parse/Parser#prev_cursor.: ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#,
68 }
69
70 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] // GRCOV_EXCL_LINE
71 pub struct ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
72 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: usize,
73 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: usize,
74 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: usize,
75 }
76
77 const WS_CURSOR_UNCLOSED_LINErust-analyzer cargo ron 0.12.0 parse/WS_CURSOR_UNCLOSED_LINE.: usize = usize::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]MAX.;
78
79 impl PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# for ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
80 fn eqrust-analyzer cargo ron 0.12.0 parse/impl#[ParserCursor][`PartialEq<Self>`]eq().(&self, other: &Selfrust-analyzer cargo ron 0.12.0 parse/impl#[ParserCursor][`PartialEq<Self>`]) -> bool {
81 self.cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().other.cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.
82 }
83 }
84
85 impl PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd# for ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
86 fn partial_cmprust-analyzer cargo ron 0.12.0 parse/impl#[ParserCursor][`PartialOrd<Self>`]partial_cmp().(&self, other: &Selfrust-analyzer cargo ron 0.12.0 parse/impl#[ParserCursor][`PartialOrd<Self>`]) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#> {
87 self.cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor..partial_cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]partial_cmp().(&other.cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.)
88 }
89 }
90
91 /// constructor and parsing utilities
92 impl<'a> Parserrust-analyzer cargo ron 0.12.0 parse/Parser#<'a> {
93 pub fn newrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]new().(src: &'a str) -> SpannedResultrust-analyzer cargo ron 0.12.0 error/SpannedResult#<Selfrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]> {
94 let mut parser = Parserrust-analyzer cargo ron 0.12.0 parse/Parser# {
95 extsrust-analyzer cargo ron 0.12.0 parse/Parser#exts.: Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::emptyrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]empty().(),
96 srcrust-analyzer cargo ron 0.12.0 parse/Parser#src.,
97 cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.: ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
98 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: 0,
99 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: 0,
100 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: 0,
101 },
102 prev_cursorrust-analyzer cargo ron 0.12.0 parse/Parser#prev_cursor.: ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
103 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: 0,
104 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: 0,
105 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: 0,
106 },
107 };
108
109 parser.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| parser.span_errorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]span_error().(e))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
110
111 // Loop over all extensions attributes
112 loop {
113 let attribute = parser.extensionsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]extensions().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| parser.span_errorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]span_error().(e))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
114
115 if attribute.is_emptyrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]is_empty().() {
116 break;
117 }
118
119 parser.extsrust-analyzer cargo ron 0.12.0 parse/Parser#exts. rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitOrAssign<Self>`]bitor_assign().attribute;
120 parser.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| parser.span_errorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]span_error().(e))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
121 }
122
123 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(parser)
124 }
125
126 fn set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(&mut self, cursor: ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#) {
127 self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor. = cursor;
128 }
129
130 pub fn span_errorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]span_error().(&self, code: Errorrust-analyzer cargo ron 0.12.0 error/Error#) -> SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
131 SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
132 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.,
133 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
134 startrust-analyzer cargo ron 0.12.0 error/Span#start.: Positionrust-analyzer cargo ron 0.12.0 error/Position#::from_src_endrust-analyzer cargo ron 0.12.0 error/impl#[Position]from_src_end().(&self.srcrust-analyzer cargo ron 0.12.0 parse/Parser#src.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#self.prev_cursorrust-analyzer cargo ron 0.12.0 parse/Parser#prev_cursor..cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().),
135 endrust-analyzer cargo ron 0.12.0 error/Span#end.: Positionrust-analyzer cargo ron 0.12.0 error/Position#::from_src_endrust-analyzer cargo ron 0.12.0 error/impl#[Position]from_src_end().(&self.srcrust-analyzer cargo ron 0.12.0 parse/Parser#src.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().),
136 },
137 }
138 }
139
140 pub fn advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(&mut self, bytes: usize) {
141 self.prev_cursorrust-analyzer cargo ron 0.12.0 parse/Parser#prev_cursor. = self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.;
142 self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().bytes;
143 }
144
145 pub fn next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_char().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<char> {
146 let c = self.peek_char_or_eofrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char_or_eof().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
147 self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().c.len_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]len_utf8().();
148 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(c)
149 }
150
151 pub fn skip_next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_next_char().(&mut self) {
152 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/drop().(self.next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_char().());
153 }
154
155 pub fn peek_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<char> {
156 self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().()
157 }
158
159 pub fn peek_char_or_eofrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char_or_eof().(&self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<char> {
160 self.peek_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char().().ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo ron 0.12.0 error/Error#::Eofrust-analyzer cargo ron 0.12.0 error/Error#Eof#)
161 }
162
163 pub fn check_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_char().(&self, c: char) -> bool {
164 self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(c)
165 }
166
167 pub fn check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().(&self, s: &str) -> bool {
168 self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(s)
169 }
170
171 pub fn srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(&self) -> &'a str {
172 &self.srcrust-analyzer cargo ron 0.12.0 parse/Parser#src.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().
173 }
174
175 pub fn pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(&self) -> &'a str {
176 &self.srcrust-analyzer cargo ron 0.12.0 parse/Parser#src.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().
177 }
178
179 pub fn consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().(&mut self, s: &str) -> bool {
180 if self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().(s) {
181 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(s.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
182
183 true
184 } else {
185 false
186 }
187 }
188
189 pub fn consume_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_char().(&mut self, c: char) -> bool {
190 if self.check_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_char().(c) {
191 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(c.len_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]len_utf8().());
192
193 true
194 } else {
195 false
196 }
197 }
198
199 fn consume_allrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_all().(&mut self, all: &[&str]) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<bool> {
200 all.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
201 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|elem| {
202 if self.consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().(elem) {
203 self.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
204
205 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true)
206 } else {
207 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false)
208 }
209 })
210 .try_foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/map/impl#[`Map<I, F>`][Iterator]try_fold().(true, |acc, x| x.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|x| x && acc))
211 }
212
213 pub fn expect_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]expect_char().(&mut self, expected: char, error: Errorrust-analyzer cargo ron 0.12.0 error/Error#) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> {
214 if self.consume_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_char().(expected) {
215 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
216 } else {
217 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(error)
218 }
219 }
220
221 #[must_use]
222 pub fn next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(&self, condition: fn(char) -> bool) -> usize {
223 self.next_chars_while_from_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_from_len().(0, condition)
224 }
225
226 #[must_use]
227 pub fn next_chars_while_from_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_from_len().(&self, from: usize, condition: fn(char) -> bool) -> usize {
228 self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().from..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().
229 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(|c| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().condition(c))
230 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().from)
231 }
232 }
233
234 /// actual parsing of ron tokens
235 impl<'a> Parserrust-analyzer cargo ron 0.12.0 parse/Parser#<'a> {
236 fn parse_integer_digitsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer_digits().<T: Numrust-analyzer cargo ron 0.12.0 parse/Num#>(
237 &mut self,
238 s: &str,
239 base: u8,
240 f: fn(&mut T, u8) -> bool,
241 ) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<T> {
242 let mut num_acc = T::from_u8rust-analyzer cargo ron 0.12.0 parse/Num#from_u8().(0);
243
244 for (i, c) in s.char_indicesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]char_indices().() {
245 if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'_' {
246 continue;
247 }
248
249 if num_acc.checked_mul_extrust-analyzer cargo ron 0.12.0 parse/Num#checked_mul_ext().(base) {
250 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(s.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
251 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::IntegerOutOfBoundsrust-analyzer cargo ron 0.12.0 error/Error#IntegerOutOfBounds#);
252 }
253
254 let digit = Selfrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]::decode_hexrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]decode_hex().(c)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
255
256 if digit rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().base {
257 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(i);
258 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidIntegerDigitrust-analyzer cargo ron 0.12.0 error/Error#InvalidIntegerDigit# { digitrust-analyzer cargo ron 0.12.0 error/Error#InvalidIntegerDigit#digit.: c, baserust-analyzer cargo ron 0.12.0 error/Error#InvalidIntegerDigit#base. });
259 }
260
261 if f(&mut num_acc, digit) {
262 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(s.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
263 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::IntegerOutOfBoundsrust-analyzer cargo ron 0.12.0 error/Error#IntegerOutOfBounds#);
264 }
265 }
266
267 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(s.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
268
269 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(num_acc)
270 }
271
272 fn parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().<T: Numrust-analyzer cargo ron 0.12.0 parse/Num#>(&mut self, sign: i8) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<T> {
273 let base = match () {
274 () if self.consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().("0b") => 2,
275 () if self.consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().("0o") => 8,
276 () if self.consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().("0x") => 16,
277 () => 10,
278 };
279
280 let num_bytes = self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(is_int_charrust-analyzer cargo ron 0.12.0 parse/is_int_char().);
281
282 if num_bytes rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 {
283 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedIntegerrust-analyzer cargo ron 0.12.0 error/Error#ExpectedInteger#);
284 }
285
286 if self.check_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_char().('_') {
287 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnderscoreAtBeginningrust-analyzer cargo ron 0.12.0 error/Error#UnderscoreAtBeginning#);
288 }
289
290 let s = &self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#num_bytes]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
291
292 if sign rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]gt().0 {
293 self.parse_integer_digitsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer_digits().(s, base, T::checked_add_extrust-analyzer cargo ron 0.12.0 parse/Num#checked_add_ext().)
294 } else {
295 self.parse_integer_digitsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer_digits().(s, base, T::checked_sub_extrust-analyzer cargo ron 0.12.0 parse/Num#checked_sub_ext().)
296 }
297 }
298
299 #[allow(clippy::too_many_lines)]
300 pub fn integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]integer().<T: Integerrust-analyzer cargo ron 0.12.0 parse/Integer#>(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<T> {
301 let src_backup = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
302
303 let is_negative = match self.peek_char_or_eofrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char_or_eof().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
304 '+' => {
305 self.skip_next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_next_char().();
306 false
307 }
308 '-' => {
309 self.skip_next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_next_char().();
310 true
311 }
312 'b' if self.consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().("b'") => {
313 // Parse a byte literal
314 let byte = match self.next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_char().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
315 '\\' => match self.parse_escaperust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_escape().(EscapeEncodingrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#::Binaryrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#Binary#, true)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
316 // we know that this byte is an ASCII character
317 EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(b) => b,
318 EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Utf8rust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Utf8#(_) => {
319 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#(
320 "Unexpected Unicode escape in byte literal",
321 ))
322 }
323 },
324 b if b.is_asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_ascii().() => b as u8,
325 _ => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedByteLiteralrust-analyzer cargo ron 0.12.0 error/Error#ExpectedByteLiteral#),
326 };
327
328 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.consume_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_char().('\'') {
329 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedByteLiteralrust-analyzer cargo ron 0.12.0 error/Error#ExpectedByteLiteral#);
330 }
331
332 let bytes_ron = &src_backup[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#src_backup.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
333
334 return T::try_from_parsed_integerrust-analyzer cargo ron 0.12.0 parse/Integer#try_from_parsed_integer().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U8#(byte), bytes_ron);
335 }
336 _ => false,
337 };
338 let sign = if is_negative { -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1 } else { 1 };
339
340 let num_bytes = self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(is_int_charrust-analyzer cargo ron 0.12.0 parse/is_int_char().);
341
342 if self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().num_bytes..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(['i', 'u']) {
343 let int_cursor = self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.;
344 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(num_bytes);
345
346 #[allow(clippy::never_loop)]
347 loop {
348 let (res, suffix_bytes) = if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("i8") {
349 let suffix_bytes = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
350 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
351 (
352 self.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<i8>(sign).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I8#),
353 suffix_bytes,
354 )
355 } else if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("i16") {
356 let suffix_bytes = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
357 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
358 (
359 self.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<i16>(sign).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I16rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I16#),
360 suffix_bytes,
361 )
362 } else if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("i32") {
363 let suffix_bytes = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
364 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
365 (
366 self.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<i32>(sign).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I32rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I32#),
367 suffix_bytes,
368 )
369 } else if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("i64") {
370 let suffix_bytes = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
371 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
372 (
373 self.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<i64>(sign).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I64#),
374 suffix_bytes,
375 )
376 } else if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("u8") {
377 let suffix_bytes = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
378 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
379 (
380 self.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<u8>(sign).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U8#),
381 suffix_bytes,
382 )
383 } else if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("u16") {
384 let suffix_bytes = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
385 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
386 (
387 self.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<u16>(sign).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U16rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U16#),
388 suffix_bytes,
389 )
390 } else if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("u32") {
391 let suffix_bytes = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
392 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
393 (
394 self.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<u32>(sign).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U32rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U32#),
395 suffix_bytes,
396 )
397 } else if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("u64") {
398 let suffix_bytes = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
399 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
400 (
401 self.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<u64>(sign).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U64#),
402 suffix_bytes,
403 )
404 } else {
405 #[cfg(feature = "integer128")]
406 if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("i128") {
407 let suffix_bytes = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
408 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
409 (
410 self.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<i128>(sign).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I128rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I128#),
411 suffix_bytes,
412 )
413 } else if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("u128") {
414 let suffix_bytes = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().();
415 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
416 (
417 self.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<u128>(sign).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U128rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U128#),
418 suffix_bytes,
419 )
420 } else {
421 break;
422 }
423 #[cfg(not(feature = "integer128"))]
424 {
425 break;
426 }
427 };
428
429 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(
430 &res,
431 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnderscoreAtBeginningrust-analyzer cargo ron 0.12.0 error/Error#UnderscoreAtBeginning# | Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidIntegerDigitrust-analyzer cargo ron 0.12.0 error/Error#InvalidIntegerDigit# { .. })
432 ) {
433 // Advance past the number suffix
434 self.skip_identifierrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_identifier().();
435 }
436
437 let integer_ron = &src_backup[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#src_backup.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().suffix_bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
438
439 return res.and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]and_then().(|parsed| T::try_from_parsed_integerrust-analyzer cargo ron 0.12.0 parse/Integer#try_from_parsed_integer().(parsed, integer_ron));
440 }
441
442 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(int_cursor);
443 }
444
445 T::parserust-analyzer cargo ron 0.12.0 parse/Integer#parse().(self, sign)
446 }
447
448 pub fn any_numberrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]any_number().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Numberrust-analyzer cargo ron 0.12.0 value/number/Number#> {
449 if self.next_bytes_is_floatrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_bytes_is_float().() {
450 return match self.floatrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]float().::<ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
451 ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#::F32rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F32#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::F32rust-analyzer cargo ron 0.12.0 value/number/Number#F32#(v.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())),
452 ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#::F64rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F64#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::F64rust-analyzer cargo ron 0.12.0 value/number/Number#F64#(v.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())),
453 };
454 }
455
456 let backup_cursor = self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.;
457
458 let (integer_err, integer_cursor) = match self.integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]integer().::<ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#>() {
459 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(integer) => {
460 return match integer {
461 ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I8#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::I8rust-analyzer cargo ron 0.12.0 value/number/Number#I8#(v)),
462 ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I16rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I16#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::I16rust-analyzer cargo ron 0.12.0 value/number/Number#I16#(v)),
463 ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I32rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I32#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::I32rust-analyzer cargo ron 0.12.0 value/number/Number#I32#(v)),
464 ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I64#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::I64rust-analyzer cargo ron 0.12.0 value/number/Number#I64#(v)),
465 #[cfg(feature = "integer128")]
466 ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I128rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I128#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::I128rust-analyzer cargo ron 0.12.0 value/number/Number#I128#(v)),
467 ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U8#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U8rust-analyzer cargo ron 0.12.0 value/number/Number#U8#(v)),
468 ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U16rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U16#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U16rust-analyzer cargo ron 0.12.0 value/number/Number#U16#(v)),
469 ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U32rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U32#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U32rust-analyzer cargo ron 0.12.0 value/number/Number#U32#(v)),
470 ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U64#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U64rust-analyzer cargo ron 0.12.0 value/number/Number#U64#(v)),
471 #[cfg(feature = "integer128")]
472 ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U128rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U128#(v) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::U128rust-analyzer cargo ron 0.12.0 value/number/Number#U128#(v)),
473 }
474 }
475 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => (err, self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.),
476 };
477
478 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(backup_cursor);
479
480 // Fall-back to parse an out-of-range integer as a float
481 match self.floatrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]float().::<ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#>() {
482 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#::F32rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F32#(v)) if self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().integer_cursor => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::F32rust-analyzer cargo ron 0.12.0 value/number/Number#F32#(v.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())),
483 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#::F64rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F64#(v)) if self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#ge().integer_cursor => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Numberrust-analyzer cargo ron 0.12.0 value/number/Number#::F64rust-analyzer cargo ron 0.12.0 value/number/Number#F64#(v.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())),
484 _ => {
485 // Return the more precise integer error
486 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(integer_cursor);
487 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(integer_err)
488 }
489 }
490 }
491
492 pub fn boolrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]bool().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<bool> {
493 if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("true") {
494 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true)
495 } else if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().("false") {
496 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false)
497 } else {
498 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedBooleanrust-analyzer cargo ron 0.12.0 error/Error#ExpectedBoolean#)
499 }
500 }
501
502 pub fn charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]char().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<char> {
503 self.expect_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]expect_char().('\'', Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedCharrust-analyzer cargo ron 0.12.0 error/Error#ExpectedChar#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
504
505 let c = self.next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_char().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
506
507 let c = if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'\\' {
508 match self.parse_escaperust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_escape().(EscapeEncodingrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#::Utf8rust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#Utf8#, true)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
509 // we know that this byte is an ASCII character
510 EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(b) => char::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/convert/impl#[char][`From<u8>`]from().(b),
511 EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Utf8rust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Utf8#(c) => c,
512 }
513 } else {
514 c
515 };
516
517 self.expect_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]expect_char().('\'', Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedCharrust-analyzer cargo ron 0.12.0 error/Error#ExpectedChar#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
518
519 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(c)
520 }
521
522 pub fn commarust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]comma().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<bool> {
523 self.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
524
525 if self.consume_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_char().(',') {
526 self.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
527
528 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true)
529 } else {
530 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false)
531 }
532 }
533
534 /// Only returns true if the char after `ident` cannot belong
535 /// to an identifier.
536 pub fn check_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_ident().(&mut self, ident: &str) -> bool {
537 self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().(ident) && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.check_ident_other_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_ident_other_char().(ident.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().())
538 }
539
540 fn check_ident_other_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_ident_other_char().(&self, index: usize) -> bool {
541 self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().index..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().
542 .charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().()
543 .nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().()
544 .map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(false, is_xid_continuerust-analyzer cargo unicode-ident 1.0.0 is_xid_continue().)
545 }
546
547 /// Check which type of struct we are currently parsing. The parsing state
548 /// is only changed in case of an error, to provide a better position.
549 ///
550 /// [`NewtypeMode::NoParensMeanUnit`] detects (tuple) structs by a leading
551 /// opening bracket and reports a unit struct otherwise.
552 /// [`NewtypeMode::InsideNewtype`] skips an initial check for unit structs,
553 /// and means that any leading opening bracket is not considered to open
554 /// a (tuple) struct but to be part of the structs inner contents.
555 ///
556 /// [`TupleMode::ImpreciseTupleOrNewtype`] only performs a cheap, O(1),
557 /// single-identifier lookahead check to distinguish tuple structs from
558 /// non-tuple structs.
559 /// [`TupleMode::DifferentiateNewtype`] performs an expensive, O(N), look-
560 /// ahead over the entire next value tree, which can span the entirety of
561 /// the remaining document in the worst case.
562 pub fn check_struct_typerust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_struct_type().(
563 &mut self,
564 newtype: NewtypeModerust-analyzer cargo ron 0.12.0 parse/NewtypeMode#,
565 tuple: TupleModerust-analyzer cargo ron 0.12.0 parse/TupleMode#,
566 ) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#> {
567 fn check_struct_type_innerrust-analyzer cargo ron 0.12.0 parse/check_struct_type_inner().(
568 parser: &mut Parserrust-analyzer cargo ron 0.12.0 parse/Parser#,
569 newtype: NewtypeModerust-analyzer cargo ron 0.12.0 parse/NewtypeMode#,
570 tuple: TupleModerust-analyzer cargo ron 0.12.0 parse/TupleMode#,
571 ) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#> {
572 if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(newtype, NewtypeModerust-analyzer cargo ron 0.12.0 parse/NewtypeMode#::NoParensMeanUnitrust-analyzer cargo ron 0.12.0 parse/NewtypeMode#NoParensMeanUnit#) && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().parser.consume_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_char().('(') {
573 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#::Unitrust-analyzer cargo ron 0.12.0 parse/StructType#Unit#);
574 }
575
576 parser.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
577
578 // Check for `Ident()`, which could be
579 // - a zero-field struct or tuple (variant)
580 // - an unwrapped newtype around a unit
581 if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(newtype, NewtypeModerust-analyzer cargo ron 0.12.0 parse/NewtypeMode#::NoParensMeanUnitrust-analyzer cargo ron 0.12.0 parse/NewtypeMode#NoParensMeanUnit#) && parser.check_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_char().(')') {
582 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#::EmptyTuplerust-analyzer cargo ron 0.12.0 parse/StructType#EmptyTuple#);
583 }
584
585 if parser.skip_identifierrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_identifier().().is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() {
586 parser.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
587
588 match parser.peek_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char().() {
589 // Definitely a struct with named fields
590 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(':') => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#::Namedrust-analyzer cargo ron 0.12.0 parse/StructType#Named#),
591 // Definitely a tuple-like struct with fields
592 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(',') => {
593 parser.skip_next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_next_char().();
594 parser.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
595 if parser.check_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_char().(')') {
596 // A one-element tuple could be a newtype
597 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#::NewtypeTuplerust-analyzer cargo ron 0.12.0 parse/StructType#NewtypeTuple#);
598 }
599 // Definitely a tuple struct with more than one field
600 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#::NonNewtypeTuplerust-analyzer cargo ron 0.12.0 parse/StructType#NonNewtypeTuple#);
601 }
602 // Either a newtype or a tuple struct
603 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(')') => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#::NewtypeTuplerust-analyzer cargo ron 0.12.0 parse/StructType#NewtypeTuple#),
604 // Something else, let's investigate further
605 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(_) | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => (),
606 };
607 }
608
609 if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(tuple, TupleModerust-analyzer cargo ron 0.12.0 parse/TupleMode#::ImpreciseTupleOrNewtyperust-analyzer cargo ron 0.12.0 parse/TupleMode#ImpreciseTupleOrNewtype#) {
610 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#::AnyTuplerust-analyzer cargo ron 0.12.0 parse/StructType#AnyTuple#);
611 }
612
613 let mut braces = 1_usize;
614 let mut more_than_one = false;
615
616 // Skip ahead to see if the value is followed by another value
617 while braces rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
618 // Skip spurious braces in comments, strings, and characters
619 parser.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
620 let cursor_backup = parser.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.;
621 if parser.charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]char().().is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().() {
622 parser.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(cursor_backup);
623 }
624 let cursor_backup = parser.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.;
625 match parser.stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]string().() {
626 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(_) => (),
627 // prevent quadratic complexity backtracking for unterminated string
628 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err @ (Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedStringEndrust-analyzer cargo ron 0.12.0 error/Error#ExpectedStringEnd# | Errorrust-analyzer cargo ron 0.12.0 error/Error#::Eofrust-analyzer cargo ron 0.12.0 error/Error#Eof#)) => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err),
629 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => parser.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(cursor_backup),
630 }
631 let cursor_backup = parser.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.;
632 // we have already checked for strings, which subsume base64 byte strings
633 match parser.byte_string_no_base64rust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]byte_string_no_base64().() {
634 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(_) => (),
635 // prevent quadratic complexity backtracking for unterminated byte string
636 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err @ (Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedStringEndrust-analyzer cargo ron 0.12.0 error/Error#ExpectedStringEnd# | Errorrust-analyzer cargo ron 0.12.0 error/Error#::Eofrust-analyzer cargo ron 0.12.0 error/Error#Eof#)) => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err),
637 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => parser.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(cursor_backup),
638 }
639
640 let c = parser.next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_char().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
641 if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(c, '(' | '[' | '{') {
642 braces rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
643 } else if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(c, ')' | ']' | '}') {
644 braces rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().1;
645 } else if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().',' && braces rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().1 {
646 parser.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
647 more_than_one = !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().parser.check_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_char().(')');
648 break;
649 }
650 }
651
652 if more_than_one {
653 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#::NonNewtypeTuplerust-analyzer cargo ron 0.12.0 parse/StructType#NonNewtypeTuple#)
654 } else {
655 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(StructTyperust-analyzer cargo ron 0.12.0 parse/StructType#::NewtypeTuplerust-analyzer cargo ron 0.12.0 parse/StructType#NewtypeTuple#)
656 }
657 }
658
659 // Create a temporary working copy
660 let backup_cursor = self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.;
661
662 let result = check_struct_type_innerrust-analyzer cargo ron 0.12.0 parse/check_struct_type_inner().(self, newtype, tuple);
663
664 if result.is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() {
665 // Revert the parser to before the struct type check
666 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(backup_cursor);
667 }
668
669 result
670 }
671
672 /// Only returns true if the char after `ident` cannot belong
673 /// to an identifier.
674 pub fn consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().(&mut self, ident: &str) -> bool {
675 if self.check_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_ident().(ident) {
676 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(ident.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
677
678 true
679 } else {
680 false
681 }
682 }
683
684 pub fn consume_struct_namerust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_struct_name().(&mut self, ident: &'static str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<bool> {
685 if self.check_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_ident().("") {
686 if self.extsrust-analyzer cargo ron 0.12.0 parse/Parser#exts..containsrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]contains().(Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::EXPLICIT_STRUCT_NAMESrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]EXPLICIT_STRUCT_NAMES.) {
687 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedStructNamerust-analyzer cargo ron 0.12.0 error/Error#ExpectedStructName#(ident.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()));
688 }
689
690 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(false);
691 }
692
693 let found_ident = match self.identifierrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]identifier().() {
694 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(maybe_ident) => maybe_ident,
695 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::SuggestRawIdentifierrust-analyzer cargo ron 0.12.0 error/Error#SuggestRawIdentifier#(found_ident)) if found_ident rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`PartialEq<&str>`]eq().ident => {
696 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::SuggestRawIdentifierrust-analyzer cargo ron 0.12.0 error/Error#SuggestRawIdentifier#(found_ident))
697 }
698 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedNamedStructLikerust-analyzer cargo ron 0.12.0 error/Error#ExpectedNamedStructLike#(ident)),
699 };
700
701 if ident.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
702 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedNamedStructLikerust-analyzer cargo ron 0.12.0 error/Error#ExpectedNamedStructLike#(ident));
703 }
704
705 if found_ident rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().ident {
706 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedDifferentStructNamerust-analyzer cargo ron 0.12.0 error/Error#ExpectedDifferentStructName# {
707 expectedrust-analyzer cargo ron 0.12.0 error/Error#ExpectedDifferentStructName#expected.: ident,
708 foundrust-analyzer cargo ron 0.12.0 error/Error#ExpectedDifferentStructName#found.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().(found_ident),
709 });
710 }
711
712 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true)
713 }
714
715 /// Returns the extensions bit mask.
716 fn extensionsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]extensions().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#> {
717 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.check_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_char().('#') {
718 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::emptyrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]empty().());
719 }
720
721 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.consume_allrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_all().(&["#", "!", "[", "enable", "("])?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
722 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedAttributerust-analyzer cargo ron 0.12.0 error/Error#ExpectedAttribute#);
723 }
724
725 self.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
726 let mut extensions = Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::emptyrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]empty().();
727
728 loop {
729 let ident = self.identifierrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]identifier().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
730 let extension = Extensionsrust-analyzer cargo ron 0.12.0 extensions/Extensions#::from_identrust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions]from_ident().(ident)
731 .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| Errorrust-analyzer cargo ron 0.12.0 error/Error#::NoSuchExtensionrust-analyzer cargo ron 0.12.0 error/Error#NoSuchExtension#(ident.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
732
733 extensions rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo ron 0.12.0 extensions/impl#[Extensions][`BitOrAssign<Self>`]bitor_assign().extension;
734
735 let comma = self.commarust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]comma().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
736
737 // If we have no comma but another item, return an error
738 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().comma && self.check_ident_other_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_ident_other_char().(0) {
739 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedCommarust-analyzer cargo ron 0.12.0 error/Error#ExpectedComma#);
740 }
741
742 // If there's no comma, assume the list ended.
743 // If there is, it might be a trailing one, thus we only
744 // continue the loop if we get an ident char.
745 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().comma || !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.check_ident_other_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_ident_other_char().(0) {
746 break;
747 }
748 }
749
750 self.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
751
752 if self.consume_allrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_all().(&[")", "]"])?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
753 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(extensions)
754 } else {
755 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedAttributeEndrust-analyzer cargo ron 0.12.0 error/Error#ExpectedAttributeEnd#)
756 }
757 }
758
759 pub fn floatrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]float().<T: Floatrust-analyzer cargo ron 0.12.0 parse/Float#>(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<T> {
760 const F32_SUFFIXrust-analyzer cargo ron 0.12.0 parse/F32_SUFFIX.: &str = "f32";
761 const F64_SUFFIXrust-analyzer cargo ron 0.12.0 parse/F64_SUFFIX.: &str = "f64";
762
763 for (literal, value_f32, value_f64) in &[
764 ("inf", f32::INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]INFINITY., f64::INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]INFINITY.),
765 ("+inf", f32::INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]INFINITY., f64::INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]INFINITY.),
766 ("-inf", f32::NEG_INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NEG_INFINITY., f64::NEG_INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]NEG_INFINITY.),
767 ("NaN", f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., f64::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]NAN.),
768 ("+NaN", f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., f64::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]NAN.),
769 ("-NaN", -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().f32::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f32/impl#[f32]NAN., -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().f64::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]NAN.),
770 ] {
771 if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().(literal) {
772 return T::parserust-analyzer cargo ron 0.12.0 parse/Float#parse().(literal);
773 }
774
775 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(suffix) = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().(literal) {
776 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(post_suffix) = suffix.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().(F32_SUFFIXrust-analyzer cargo ron 0.12.0 parse/F32_SUFFIX.) {
777 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().post_suffix.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().().map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(false, is_xid_continuerust-analyzer cargo unicode-ident 1.0.0 is_xid_continue().) {
778 let float_ron = &self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#literal.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().F32_SUFFIXrust-analyzer cargo ron 0.12.0 parse/F32_SUFFIX..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
779 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(literal.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().F32_SUFFIXrust-analyzer cargo ron 0.12.0 parse/F32_SUFFIX..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
780 return T::try_from_parsed_floatrust-analyzer cargo ron 0.12.0 parse/Float#try_from_parsed_float().(ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#::F32rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F32#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().value_f32), float_ron);
781 }
782 }
783
784 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(post_suffix) = suffix.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().(F64_SUFFIXrust-analyzer cargo ron 0.12.0 parse/F64_SUFFIX.) {
785 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().post_suffix.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().().map_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map_or().(false, is_xid_continuerust-analyzer cargo unicode-ident 1.0.0 is_xid_continue().) {
786 let float_ron = &self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#literal.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().F64_SUFFIXrust-analyzer cargo ron 0.12.0 parse/F64_SUFFIX..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
787 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(literal.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().F64_SUFFIXrust-analyzer cargo ron 0.12.0 parse/F64_SUFFIX..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
788 return T::try_from_parsed_floatrust-analyzer cargo ron 0.12.0 parse/Float#try_from_parsed_float().(ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#::F64rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F64#(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().value_f64), float_ron);
789 }
790 }
791 }
792 }
793
794 let num_bytes = self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(is_float_charrust-analyzer cargo ron 0.12.0 parse/is_float_char().);
795
796 if num_bytes rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 {
797 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedFloatrust-analyzer cargo ron 0.12.0 error/Error#ExpectedFloat#);
798 }
799
800 if self.check_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_char().('_') {
801 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnderscoreAtBeginningrust-analyzer cargo ron 0.12.0 error/Error#UnderscoreAtBeginning#);
802 }
803
804 let mut f = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]with_capacity().(num_bytes);
805 let mut allow_underscore = false;
806
807 for (i, c) in self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#num_bytes]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..char_indicesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]char_indices().() {
808 match c {
809 '_' if allow_underscore => continue,
810 '_' => {
811 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(i);
812 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::FloatUnderscorerust-analyzer cargo ron 0.12.0 error/Error#FloatUnderscore#);
813 }
814 '0'..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#'9' | 'e' | 'E' => allow_underscore = true,
815 '.' => allow_underscore = false,
816 _ => (),
817 }
818
819 // we know that the byte is an ASCII character here
820 f.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c);
821 }
822
823 if self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().num_bytes..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('f') {
824 let backup_cursor = self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.;
825 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(num_bytes);
826
827 #[allow(clippy::never_loop)]
828 loop {
829 let res = if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().(F32_SUFFIXrust-analyzer cargo ron 0.12.0 parse/F32_SUFFIX.) {
830 f32::from_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/dec2flt/impl#[f32][FromStr]from_str().(&f).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#::F32rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F32#)
831 } else if self.consume_identrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_ident().(F64_SUFFIXrust-analyzer cargo ron 0.12.0 parse/F64_SUFFIX.) {
832 f64::from_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/dec2flt/impl#[f64][FromStr]from_str().(&f).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#::F64rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F64#)
833 } else {
834 break;
835 };
836
837 let parsed = if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(parsed) = res {
838 parsed
839 } else {
840 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(backup_cursor);
841 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedFloatrust-analyzer cargo ron 0.12.0 error/Error#ExpectedFloat#);
842 };
843
844 let float_ron = &self.srcrust-analyzer cargo ron 0.12.0 parse/Parser#src.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().backup_cursor.cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
845
846 return T::try_from_parsed_floatrust-analyzer cargo ron 0.12.0 parse/Float#try_from_parsed_float().(parsed, float_ron);
847 }
848
849 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(backup_cursor);
850 }
851
852 let value = T::parserust-analyzer cargo ron 0.12.0 parse/Float#parse().(&f)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
853
854 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(num_bytes);
855
856 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value)
857 }
858
859 pub fn skip_identifierrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_identifier().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&'a str> {
860 #[allow(clippy::nonminimal_bool)]
861 if self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("b\"") // byte string
862 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("b'") // byte literal
863 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("br#") // raw byte string
864 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("br\"") // raw byte string
865 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("r\"") // raw string
866 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("r#\"") // raw string
867 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("r##") // raw string
868 || false
869 {
870 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
871 }
872
873 if self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("r#") {
874 // maybe a raw identifier
875 let len = self.next_chars_while_from_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_from_len().(2, is_ident_raw_charrust-analyzer cargo ron 0.12.0 parse/is_ident_raw_char().);
876 if len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 {
877 let ident = &self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
878 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().len);
879 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ident);
880 }
881 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
882 }
883
884 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) = self.peek_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char().() {
885 // maybe a normal identifier
886 if is_ident_first_charrust-analyzer cargo ron 0.12.0 parse/is_ident_first_char().(c) {
887 let len =
888 c.len_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]len_utf8().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().self.next_chars_while_from_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_from_len().(c.len_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]len_utf8().(), is_xid_continuerust-analyzer cargo unicode-ident 1.0.0 is_xid_continue().);
889 let ident = &self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
890 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(len);
891 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ident);
892 }
893 }
894
895 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
896 }
897
898 pub fn identifierrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]identifier().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<&'a str> {
899 let first = self.peek_char_or_eofrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char_or_eof().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
900 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_ident_first_charrust-analyzer cargo ron 0.12.0 parse/is_ident_first_char().(first) {
901 if is_ident_raw_charrust-analyzer cargo ron 0.12.0 parse/is_ident_raw_char().(first) {
902 let ident_bytes = self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(is_ident_raw_charrust-analyzer cargo ron 0.12.0 parse/is_ident_raw_char().);
903 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::SuggestRawIdentifierrust-analyzer cargo ron 0.12.0 error/Error#SuggestRawIdentifier#(
904 self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#ident_bytes]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
905 ));
906 }
907
908 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedIdentifierrust-analyzer cargo ron 0.12.0 error/Error#ExpectedIdentifier#);
909 }
910
911 // If the next 2-3 bytes signify the start of a (raw) (byte) string
912 // literal, return an error.
913 #[allow(clippy::nonminimal_bool)]
914 if self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("b\"") // byte string
915 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("b'") // byte literal
916 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("br#") // raw byte string
917 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("br\"") // raw byte string
918 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("r\"") // raw string
919 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("r#\"") // raw string
920 || self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("r##") // raw string
921 || false
922 {
923 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedIdentifierrust-analyzer cargo ron 0.12.0 error/Error#ExpectedIdentifier#);
924 }
925
926 let length = if self.check_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]check_str().("r#") {
927 let cursor_backup = self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor.;
928
929 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(2);
930
931 // Note: it's important to check this before advancing forward, so that
932 // the value-type deserializer can fall back to parsing it differently.
933 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.peek_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) if is_ident_raw_charrust-analyzer cargo ron 0.12.0 parse/is_ident_raw_char().(c)) {
934 self.set_cursorrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]set_cursor().(cursor_backup);
935 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedIdentifierrust-analyzer cargo ron 0.12.0 error/Error#ExpectedIdentifier#);
936 }
937
938 self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(is_ident_raw_charrust-analyzer cargo ron 0.12.0 parse/is_ident_raw_char().)
939 } else if first rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'r' {
940 let std_ident_length = self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(is_xid_continuerust-analyzer cargo unicode-ident 1.0.0 is_xid_continue().);
941 let raw_ident_length = self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(is_ident_raw_charrust-analyzer cargo ron 0.12.0 parse/is_ident_raw_char().);
942
943 if raw_ident_length rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().std_ident_length {
944 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::SuggestRawIdentifierrust-analyzer cargo ron 0.12.0 error/Error#SuggestRawIdentifier#(
945 self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#raw_ident_length]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
946 ));
947 }
948
949 std_ident_length
950 } else {
951 let std_ident_length = first.len_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]len_utf8().()
952 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().self.next_chars_while_from_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_from_len().(first.len_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]len_utf8().(), is_xid_continuerust-analyzer cargo unicode-ident 1.0.0 is_xid_continue().);
953 let raw_ident_length = self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(is_ident_raw_charrust-analyzer cargo ron 0.12.0 parse/is_ident_raw_char().);
954
955 if raw_ident_length rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().std_ident_length {
956 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::SuggestRawIdentifierrust-analyzer cargo ron 0.12.0 error/Error#SuggestRawIdentifier#(
957 self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#raw_ident_length]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
958 ));
959 }
960
961 std_ident_length
962 };
963
964 let ident = &self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#length]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
965 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(length);
966
967 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ident)
968 }
969
970 pub fn next_bytes_is_floatrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_bytes_is_float().(&mut self) -> bool {
971 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) = self.peek_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char().() {
972 let skip = match c {
973 '+' | '-' => 1,
974 _ => 0,
975 };
976 let valid_float_len = self.next_chars_while_from_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_from_len().(skip, is_float_charrust-analyzer cargo ron 0.12.0 parse/is_float_char().);
977 let valid_int_len = self.next_chars_while_from_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_from_len().(skip, is_int_charrust-analyzer cargo ron 0.12.0 parse/is_int_char().);
978 valid_float_len rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().valid_int_len
979 } else {
980 false
981 }
982 }
983
984 pub fn skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<()> {
985 if (self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().WS_CURSOR_UNCLOSED_LINErust-analyzer cargo ron 0.12.0 parse/WS_CURSOR_UNCLOSED_LINE.)
986 && ((self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.)
987 {
988 // the last whitespace is disjoint from this one, we need to track a new one
989 self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor. = self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.;
990 }
991
992 if self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
993 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(());
994 }
995
996 loop {
997 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(is_whitespace_charrust-analyzer cargo ron 0.12.0 parse/is_whitespace_char().));
998
999 match self.skip_commentrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_comment().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1000 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => break,
1001 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Commentrust-analyzer cargo ron 0.12.0 parse/Comment#::UnclosedLinerust-analyzer cargo ron 0.12.0 parse/Comment#UnclosedLine#) => {
1002 self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len. = WS_CURSOR_UNCLOSED_LINErust-analyzer cargo ron 0.12.0 parse/WS_CURSOR_UNCLOSED_LINE.;
1003 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(());
1004 }
1005 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Commentrust-analyzer cargo ron 0.12.0 parse/Comment#::ClosedLinerust-analyzer cargo ron 0.12.0 parse/Comment#ClosedLine# | Commentrust-analyzer cargo ron 0.12.0 parse/Comment#::Blockrust-analyzer cargo ron 0.12.0 parse/Comment#Block#) => continue,
1006 }
1007 }
1008
1009 self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len. = self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.;
1010
1011 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
1012 }
1013
1014 pub fn has_unclosed_line_commentrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]has_unclosed_line_comment().(&self) -> bool {
1015 self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() && self.cursorrust-analyzer cargo ron 0.12.0 parse/Parser#cursor..last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().WS_CURSOR_UNCLOSED_LINErust-analyzer cargo ron 0.12.0 parse/WS_CURSOR_UNCLOSED_LINE.
1016 }
1017
1018 pub fn byte_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]byte_string().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#<'a>> {
1019 fn expected_byte_string_found_base64rust-analyzer cargo ron 0.12.0 parse/expected_byte_string_found_base64().(
1020 base64_str: &ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#,
1021 byte_str: &ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#,
1022 ) -> Errorrust-analyzer cargo ron 0.12.0 error/Error# {
1023 let byte_str = match &byte_str {
1024 ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#::Allocatedrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#Allocated#(b) => b.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().(),
1025 ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#::Slicerust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#Slice#(b) => b,
1026 }
1027 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
1028 .flat_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#flat_map().(|c| corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core ascii/::escape_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ascii/escape_default().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c))
1029 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(char::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/convert/impl#[char][`From<u8>`]from().)
1030 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>();
1031 let base64_str = match &base64_str {
1032 ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#::Allocatedrust-analyzer cargo ron 0.12.0 parse/ParsedStr#Allocated#(s) => s.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().(),
1033 ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#::Slicerust-analyzer cargo ron 0.12.0 parse/ParsedStr#Slice#(s) => s,
1034 };
1035
1036 Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidValueForTyperust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType# {
1037 expectedrust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType#expected.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("the Rusty byte string b\"{}\"", byte_str),
1038 foundrust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType#found.: formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("the ambiguous base64 string {:?}", base64_str),
1039 }
1040 }
1041
1042 // FIXME @juntyr: remove in v0.13, since only byte_string_no_base64 will
1043 // be used
1044 if self.consume_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_char().('"') {
1045 let base64_str = self.escaped_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]escaped_string().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1046 let base64_result = ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#::try_from_base64rust-analyzer cargo ron 0.12.0 parse/impl#[`ParsedByteStr<'a>`]try_from_base64().(&base64_str);
1047
1048 match base64_result {
1049 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(byte_str) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(expected_byte_string_found_base64rust-analyzer cargo ron 0.12.0 parse/expected_byte_string_found_base64().(&base64_str, &byte_str)),
1050 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedByteStringrust-analyzer cargo ron 0.12.0 error/Error#ExpectedByteString#),
1051 }
1052 } else if self.consume_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_char().('r') {
1053 let base64_str = self.raw_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]raw_string().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1054 let base64_result = ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#::try_from_base64rust-analyzer cargo ron 0.12.0 parse/impl#[`ParsedByteStr<'a>`]try_from_base64().(&base64_str);
1055
1056 match base64_result {
1057 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(byte_str) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(expected_byte_string_found_base64rust-analyzer cargo ron 0.12.0 parse/expected_byte_string_found_base64().(&base64_str, &byte_str)),
1058 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedByteStringrust-analyzer cargo ron 0.12.0 error/Error#ExpectedByteString#),
1059 }
1060 } else {
1061 self.byte_string_no_base64rust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]byte_string_no_base64().()
1062 }
1063 }
1064
1065 pub fn byte_string_no_base64rust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]byte_string_no_base64().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#<'a>> {
1066 if self.consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().("b\"") {
1067 self.escaped_byte_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]escaped_byte_string().()
1068 } else if self.consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().("br") {
1069 self.raw_byte_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]raw_byte_string().()
1070 } else {
1071 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedByteStringrust-analyzer cargo ron 0.12.0 error/Error#ExpectedByteString#)
1072 }
1073 }
1074
1075 fn escaped_byte_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]escaped_byte_string().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#<'a>> {
1076 match self.escaped_byte_bufrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]escaped_byte_buf().(EscapeEncodingrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#::Binaryrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#Binary#) {
1077 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((bytes, advance)) => {
1078 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(advance);
1079 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(bytes)
1080 }
1081 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err),
1082 }
1083 }
1084
1085 fn raw_byte_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]raw_byte_string().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#<'a>> {
1086 match self.raw_byte_bufrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]raw_byte_buf().() {
1087 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((bytes, advance)) => {
1088 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(advance);
1089 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(bytes)
1090 }
1091 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedStringrust-analyzer cargo ron 0.12.0 error/Error#ExpectedString#) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedByteStringrust-analyzer cargo ron 0.12.0 error/Error#ExpectedByteString#),
1092 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err),
1093 }
1094 }
1095
1096 pub fn stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]string().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#<'a>> {
1097 if self.consume_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_char().('"') {
1098 self.escaped_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]escaped_string().()
1099 } else if self.consume_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_char().('r') {
1100 self.raw_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]raw_string().()
1101 } else {
1102 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedStringrust-analyzer cargo ron 0.12.0 error/Error#ExpectedString#)
1103 }
1104 }
1105
1106 fn escaped_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]escaped_string().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#<'a>> {
1107 match self.escaped_byte_bufrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]escaped_byte_buf().(EscapeEncodingrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#::Utf8rust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#Utf8#) {
1108 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((bytes, advance)) => {
1109 let string = ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#::try_from_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`ParsedStr<'a>`]try_from_bytes().(bytes).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Errorrust-analyzer cargo ron 0.12.0 error/Error#::fromrust-analyzer cargo ron 0.12.0 error/impl#[Error][`From<Utf8Error>`]from().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1110 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(advance);
1111 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(string)
1112 }
1113 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err),
1114 }
1115 }
1116
1117 fn raw_stringrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]raw_string().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#<'a>> {
1118 match self.raw_byte_bufrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]raw_byte_buf().() {
1119 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((bytes, advance)) => {
1120 let string = ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#::try_from_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`ParsedStr<'a>`]try_from_bytes().(bytes).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Errorrust-analyzer cargo ron 0.12.0 error/Error#::fromrust-analyzer cargo ron 0.12.0 error/impl#[Error][`From<Utf8Error>`]from().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1121 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(advance);
1122 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(string)
1123 }
1124 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err),
1125 }
1126 }
1127
1128 fn escaped_byte_bufrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]escaped_byte_buf().(&mut self, encoding: EscapeEncodingrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<(ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#<'a>, usize)> {
1129 // Checking for '"' and '\\' separately is faster than searching for both at the same time
1130 let str_end = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().('"').ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedStringEndrust-analyzer cargo ron 0.12.0 error/Error#ExpectedStringEnd#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1131 let escape = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#str_end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().('\\');
1132
1133 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(escape) = escape {
1134 // Now check if escaping is used inside the string
1135 let mut i = escape;
1136 let mut s = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().();
1137
1138 loop {
1139 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1);
1140
1141 match self.parse_escaperust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_escape().(encoding, false)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1142 EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(c) => s.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(c),
1143 EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Utf8rust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Utf8#(c) => match c.len_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]len_utf8().() {
1144 1 => s.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(c as u8),
1145 len => {
1146 let start = s.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().();
1147 s.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::repeatrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/repeat/repeat().(0).takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take().(len));
1148 c.encode_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]encode_utf8().(&mut s[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().);
1149 }
1150 },
1151 }
1152
1153 // Checking for '"' and '\\' separately is faster than searching for both at the same time
1154 let new_str_end = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().('"').ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedStringEndrust-analyzer cargo ron 0.12.0 error/Error#ExpectedStringEnd#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1155 let new_escape = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#new_str_end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().('\\');
1156
1157 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(new_escape) = new_escape {
1158 s.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#new_escape]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
1159 i = new_escape;
1160 } else {
1161 s.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#new_str_end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
1162 // Advance to the end of the string + 1 for the `"`.
1163 break Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#::Allocatedrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#Allocated#(s), new_str_end rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1));
1164 }
1165 }
1166 } else {
1167 let s = &self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#str_end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
1168
1169 // Advance by the number of bytes of the string + 1 for the `"`.
1170 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#::Slicerust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#Slice#(s), str_end rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1))
1171 }
1172 }
1173
1174 fn raw_byte_bufrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]raw_byte_buf().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<(ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#<'a>, usize)> {
1175 let num_hashes = self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(|c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'#');
1176 let hashes = &self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#num_hashes]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
1177 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(num_hashes);
1178
1179 self.expect_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]expect_char().('"', Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedStringrust-analyzer cargo ron 0.12.0 error/Error#ExpectedString#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1180
1181 let ending = ["\"", hashes].concatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]concat().();
1182 let i = self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(&ending).ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedStringEndrust-analyzer cargo ron 0.12.0 error/Error#ExpectedStringEnd#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1183
1184 let s = &self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
1185
1186 // Advance by the number of bytes of the byte string
1187 // + `num_hashes` + 1 for the `"`.
1188 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#::Slicerust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#Slice#(s), i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().num_hashes rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1))
1189 }
1190
1191 fn decode_ascii_escaperust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]decode_ascii_escape().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<u8> {
1192 let mut n = 0;
1193 for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2 {
1194 n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`ShlAssign<i32>`]shl_assign().<<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`ShlAssign<i32>`]shl_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`ShlAssign<i32>`]shl_assign().4;
1195 let byte = self.next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_char().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1196 let decoded = Selfrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]::decode_hexrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]decode_hex().(byte)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1197 n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitOrAssign<Self>`]bitor_assign().decoded;
1198 }
1199
1200 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(n)
1201 }
1202
1203 #[inline]
1204 fn decode_hexrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]decode_hex().(c: char) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<u8> {
1205 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().c.is_asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_ascii().() {
1206 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#("Non-hex digit found"));
1207 }
1208
1209 // c is an ASCII character that can be losslessly cast to u8
1210 match c as u8 {
1211 c @ b'0'..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#b'9' => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().b'0'),
1212 c @ b'a'..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#b'f' => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(10 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().b'a'),
1213 c @ b'A'..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#b'F' => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(10 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().b'A'),
1214 _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#("Non-hex digit found")),
1215 }
1216 }
1217
1218 fn parse_escaperust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_escape().(&mut self, encoding: EscapeEncodingrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#, is_char: bool) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#> {
1219 let c = match self.next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_char().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1220 '\'' => EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(b'\''),
1221 '"' => EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(b'"'),
1222 '\\' => EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(b'\\'),
1223 'n' => EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(b'\n'),
1224 'r' => EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(b'\r'),
1225 't' => EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(b'\t'),
1226 '0' => EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(b'\0'),
1227 'x' => {
1228 // Fast exit for ascii escape in byte string
1229 let b: u8 = self.decode_ascii_escaperust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]decode_ascii_escape().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1230 if let EscapeEncodingrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#::Binaryrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#Binary# = encoding {
1231 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(b));
1232 }
1233
1234 // Fast exit for ascii character in UTF-8 string
1235 let mut bytes = [b, 0, 0, 0];
1236 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c)) = from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|s| s.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().()) {
1237 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Utf8rust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Utf8#(c));
1238 }
1239
1240 if is_char {
1241 // Character literals are not allowed to use multiple byte
1242 // escapes to build a unicode character
1243 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#(
1244 "Not a valid byte-escaped Unicode character",
1245 ));
1246 }
1247
1248 // UTF-8 character needs up to four bytes and we have already
1249 // consumed one, so at most three to go
1250 for i in 1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4 {
1251 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().(r"\x") {
1252 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#(
1253 "Not a valid byte-escaped Unicode character",
1254 ));
1255 }
1256
1257 bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = self.decode_ascii_escaperust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]decode_ascii_escape().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1258
1259 // Check if we now have a valid UTF-8 character
1260 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c)) = from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|s| s.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().()) {
1261 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Utf8rust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Utf8#(c));
1262 }
1263 }
1264
1265 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#(
1266 "Not a valid byte-escaped Unicode character",
1267 ));
1268 }
1269 'u' => {
1270 self.expect_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]expect_char().('{', Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#("Missing { in Unicode escape"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1271
1272 let mut bytes: u32 = 0;
1273 let mut num_digits = 0;
1274
1275 while num_digits rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]lt().6 {
1276 let byte = self.peek_char_or_eofrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]peek_char_or_eof().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1277
1278 if byte rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'}' {
1279 break;
1280 }
1281
1282 self.skip_next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_next_char().();
1283 num_digits rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().1;
1284
1285 let byte = Selfrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]::decode_hexrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]decode_hex().(byte)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1286 bytes rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`ShlAssign<i32>`]shl_assign().<<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`ShlAssign<i32>`]shl_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`ShlAssign<i32>`]shl_assign().4;
1287 bytes rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOrAssign<Self>`]bitor_assign().u32::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`From<u8>`]from().(byte);
1288 }
1289
1290 if num_digits rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 {
1291 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#(
1292 "Expected 1-6 digits, got 0 digits in Unicode escape",
1293 ));
1294 }
1295
1296 self.expect_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]expect_char().(
1297 '}',
1298 Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#("No } at the end of Unicode escape"),
1299 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1300 let c = char_from_u32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/from_u32().(bytes).ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#(
1301 "Not a valid Unicode-escaped character",
1302 ))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1303
1304 EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#::Utf8rust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Utf8#(c)
1305 }
1306 _ => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidEscaperust-analyzer cargo ron 0.12.0 error/Error#InvalidEscape#("Unknown escape character")),
1307 };
1308
1309 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(c)
1310 }
1311
1312 fn skip_commentrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_comment().(&mut self) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Commentrust-analyzer cargo ron 0.12.0 parse/Comment#>> {
1313 if self.consume_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_char().('/') {
1314 match self.next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_char().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1315 '/' => {
1316 let bytes = self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(|c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne().'\n');
1317
1318 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(bytes);
1319
1320 if self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
1321 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Commentrust-analyzer cargo ron 0.12.0 parse/Comment#::UnclosedLinerust-analyzer cargo ron 0.12.0 parse/Comment#UnclosedLine#))
1322 } else {
1323 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Commentrust-analyzer cargo ron 0.12.0 parse/Comment#::ClosedLinerust-analyzer cargo ron 0.12.0 parse/Comment#ClosedLine#))
1324 }
1325 }
1326 '*' => {
1327 let mut level = 1;
1328
1329 while level rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialOrd<Self>`]gt().0 {
1330 let bytes = self.next_chars_while_lenrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_chars_while_len().(|c| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(c, '/' | '*'));
1331
1332 if self.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
1333 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnclosedBlockCommentrust-analyzer cargo ron 0.12.0 error/Error#UnclosedBlockComment#);
1334 }
1335
1336 self.advance_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]advance_bytes().(bytes);
1337
1338 // check whether / or * and take action
1339 if self.consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().("/*") {
1340 level rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`AddAssign<Self>`]add_assign().1;
1341 } else if self.consume_strrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]consume_str().("*/") {
1342 level rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`SubAssign<Self>`]sub_assign().1;
1343 } else {
1344 self.next_charrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_char().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnclosedBlockCommentrust-analyzer cargo ron 0.12.0 error/Error#UnclosedBlockComment#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1345 }
1346 }
1347
1348 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Commentrust-analyzer cargo ron 0.12.0 parse/Comment#::Blockrust-analyzer cargo ron 0.12.0 parse/Comment#Block#))
1349 }
1350 c => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo ron 0.12.0 error/Error#::UnexpectedCharrust-analyzer cargo ron 0.12.0 error/Error#UnexpectedChar#(c)),
1351 }
1352 } else {
1353 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)
1354 }
1355 }
1356 }
1357
1358 enum Commentrust-analyzer cargo ron 0.12.0 parse/Comment# {
1359 ClosedLinerust-analyzer cargo ron 0.12.0 parse/Comment#ClosedLine#,
1360 UnclosedLinerust-analyzer cargo ron 0.12.0 parse/Comment#UnclosedLine#,
1361 Blockrust-analyzer cargo ron 0.12.0 parse/Comment#Block#,
1362 }
1363
1364 pub trait Numrust-analyzer cargo ron 0.12.0 parse/Num# {
1365 fn from_u8rust-analyzer cargo ron 0.12.0 parse/Num#from_u8().(x: u8) -> Self;
1366
1367 /// Returns `true` on overflow
1368 fn checked_mul_extrust-analyzer cargo ron 0.12.0 parse/Num#checked_mul_ext().(&mut self, x: u8) -> bool;
1369
1370 /// Returns `true` on overflow
1371 fn checked_add_extrust-analyzer cargo ron 0.12.0 parse/Num#checked_add_ext().(&mut self, x: u8) -> bool;
1372
1373 /// Returns `true` on overflow
1374 fn checked_sub_extrust-analyzer cargo ron 0.12.0 parse/Num#checked_sub_ext().(&mut self, x: u8) -> bool;
1375 }
1376
1377 macro_rules! impl_numrust-analyzer cargo ron 0.12.0 parse/impl_num! {
1378 ($ty:ty) => {
1379 impl Num for $ty {
1380 fn from_u8(x: u8) -> Self {
1381 x as $ty
1382 }
1383
1384 fn checked_mul_ext(&mut self, x: u8) -> bool {
1385 match self.checked_mul(Self::from_u8(x)) {
1386 Some(n) => {
1387 *self = n;
1388 false
1389 }
1390 None => true,
1391 }
1392 }
1393
1394 fn checked_add_ext(&mut self, x: u8) -> bool {
1395 match self.checked_add(Self::from_u8(x)) {
1396 Some(n) => {
1397 *self = n;
1398 false
1399 }
1400 None => true,
1401 }
1402 }
1403
1404 fn checked_sub_ext(&mut self, x: u8) -> bool {
1405 match self.checked_sub(Self::from_u8(x)) {
1406 Some(n) => {
1407 *self = n;
1408 false
1409 }
1410 None => true,
1411 }
1412 }
1413 }
1414 };
1415 ($($tys:ty)*) => {
1416 $( impl_num!($tys); )*
1417 };
1418 }
1419
1420 impl_numrust-analyzer cargo ron 0.12.0 parse/impl_num!! { i8 i16 i32 i64 u8 u16 u32 u64 }
1421
1422 #[cfg(feature = "integer128")]
1423 impl_numrust-analyzer cargo ron 0.12.0 parse/impl_num!! { i128 u128 }
1424
1425 pub trait Integerrust-analyzer cargo ron 0.12.0 parse/Integer#: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# {
1426 fn parserust-analyzer cargo ron 0.12.0 parse/Integer#parse().(parser: &mut Parserrust-analyzer cargo ron 0.12.0 parse/Parser#, sign: i8) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Self>;
1427
1428 fn try_from_parsed_integerrust-analyzer cargo ron 0.12.0 parse/Integer#try_from_parsed_integer().(parsed: ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#, ron: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Self>;
1429 }
1430
1431 macro_rules! impl_integerrust-analyzer cargo ron 0.12.0 parse/impl_integer! {
1432 ($wrap:ident($ty:ty)) => {
1433 impl Integer for $ty {
1434 fn parse(parser: &mut Parser, sign: i8) -> Result<Self> {
1435 parser.parse_integer(sign)
1436 }
1437
1438 fn try_from_parsed_integer(parsed: ParsedInteger, ron: &str) -> Result<Self> {
1439 match parsed {
1440 ParsedInteger::$wrap(v) => Ok(v),
1441 _ => Err(Error::InvalidValueForType {
1442 expected: format!(
1443 "a{} {}-bit {}signed integer",
1444 if <$ty>::BITS == 8 { "n" } else { "n" },
1445 <$ty>::BITS,
1446 if <$ty>::MIN == 0 { "un" } else { "" },
1447 ),
1448 found: String::from(ron),
1449 }),
1450 }
1451 }
1452 }
1453 };
1454 ($($wraps:ident($tys:ty))*) => {
1455 $( impl_integer!($wraps($tys)); )*
1456 };
1457 }
1458
1459 impl_integerrust-analyzer cargo ron 0.12.0 parse/impl_integer!! {
1460 I8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I8#(i8) I16rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I16#(i16) I32rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I32#(i32) I64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I64#(i64)
1461 U8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U8#(u8) U16rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U16#(u16) U32rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U32#(u32) U64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U64#(u64)
1462 }
1463
1464 #[cfg(feature = "integer128")]
1465 impl_integerrust-analyzer cargo ron 0.12.0 parse/impl_integer!! { I128rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I128#(i128) U128rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U128#(u128) }
1466
1467 pub enum ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger# {
1468 I8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I8#(i8),
1469 I16rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I16#(i16),
1470 I32rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I32#(i32),
1471 I64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I64#(i64),
1472 #[cfg(feature = "integer128")]
1473 I128rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I128#(i128),
1474 U8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U8#(u8),
1475 U16rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U16#(u16),
1476 U32rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U32#(u32),
1477 U64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U64#(u64),
1478 #[cfg(feature = "integer128")]
1479 U128rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U128#(u128),
1480 }
1481
1482 impl Integerrust-analyzer cargo ron 0.12.0 parse/Integer# for ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger# {
1483 fn parserust-analyzer cargo ron 0.12.0 parse/impl#[ParsedInteger][Integer]parse().(parser: &mut Parserrust-analyzer cargo ron 0.12.0 parse/Parser#, sign: i8) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 parse/impl#[ParsedInteger][Integer]> {
1484 if sign rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i8][`PartialOrd<Self>`]lt().0 {
1485 let signed = parser.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<LargeSIntrust-analyzer cargo ron 0.12.0 parse/LargeSInt#>(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().1)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1486
1487 return if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = i8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i8][`TryFrom<i128>`]try_from().(signed) {
1488 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I8#(x))
1489 } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = i16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i16][`TryFrom<i128>`]try_from().(signed) {
1490 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I16rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I16#(x))
1491 } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = i32::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`TryFrom<i128>`]try_from().(signed) {
1492 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I32rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I32#(x))
1493 } else {
1494 #[cfg(not(feature = "integer128"))]
1495 {
1496 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I64#(signed))
1497 }
1498 #[cfg(feature = "integer128")]
1499 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = i64::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i64][`TryFrom<i128>`]try_from().(signed) {
1500 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I64#(x))
1501 } else {
1502 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::I128rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#I128#(signed))
1503 }
1504 };
1505 }
1506
1507 let unsigned = parser.parse_integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]parse_integer().::<LargeUIntrust-analyzer cargo ron 0.12.0 parse/LargeUInt#>(1)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1508
1509 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u128>`]try_from().(unsigned) {
1510 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U8rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U8#(x))
1511 } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = u16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u16][`TryFrom<u128>`]try_from().(unsigned) {
1512 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U16rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U16#(x))
1513 } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = u32::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`TryFrom<u128>`]try_from().(unsigned) {
1514 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U32rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U32#(x))
1515 } else {
1516 #[cfg(not(feature = "integer128"))]
1517 {
1518 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U64#(unsigned))
1519 }
1520 #[cfg(feature = "integer128")]
1521 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = u64::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u64][`TryFrom<u128>`]try_from().(unsigned) {
1522 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U64rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U64#(x))
1523 } else {
1524 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#::U128rust-analyzer cargo ron 0.12.0 parse/ParsedInteger#U128#(unsigned))
1525 }
1526 }
1527 }
1528
1529 fn try_from_parsed_integerrust-analyzer cargo ron 0.12.0 parse/impl#[ParsedInteger][Integer]try_from_parsed_integer().(parsed: ParsedIntegerrust-analyzer cargo ron 0.12.0 parse/ParsedInteger#, _ron: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 parse/impl#[ParsedInteger][Integer]> {
1530 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(parsed)
1531 }
1532 }
1533
1534 pub trait Floatrust-analyzer cargo ron 0.12.0 parse/Float#: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized# {
1535 fn parserust-analyzer cargo ron 0.12.0 parse/Float#parse().(float: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Self>;
1536
1537 fn try_from_parsed_floatrust-analyzer cargo ron 0.12.0 parse/Float#try_from_parsed_float().(parsed: ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#, ron: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Self>;
1538 }
1539
1540 macro_rules! impl_floatrust-analyzer cargo ron 0.12.0 parse/impl_float! {
1541 ($wrap:ident($ty:ty: $bits:expr)) => {
1542 impl Float for $ty {
1543 fn parse(float: &str) -> Result<Self> {
1544 <$ty>::from_str(float).map_err(|_| Error::ExpectedFloat)
1545 }
1546
1547 fn try_from_parsed_float(parsed: ParsedFloat, ron: &str) -> Result<Self> {
1548 match parsed {
1549 ParsedFloat::$wrap(v) => Ok(v),
1550 _ => Err(Error::InvalidValueForType {
1551 expected: format!(
1552 "a {}-bit floating point number", $bits,
1553 ),
1554 found: String::from(ron),
1555 }),
1556 }
1557 }
1558 }
1559 };
1560 ($($wraps:ident($tys:ty: $bits:expr))*) => {
1561 $( impl_float!($wraps($tys: $bits)); )*
1562 };
1563 }
1564
1565 impl_floatrust-analyzer cargo ron 0.12.0 parse/impl_float!! { F32rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F32#(f32: 32) F64rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F64#(f64: 64) }
1566
1567 pub enum ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat# {
1568 F32rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F32#(f32),
1569 F64rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F64#(f64),
1570 }
1571
1572 impl Floatrust-analyzer cargo ron 0.12.0 parse/Float# for ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat# {
1573 fn parserust-analyzer cargo ron 0.12.0 parse/impl#[ParsedFloat][Float]parse().(float: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 parse/impl#[ParsedFloat][Float]> {
1574 let value = f64::from_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/dec2flt/impl#[f64][FromStr]from_str().(float).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedFloatrust-analyzer cargo ron 0.12.0 error/Error#ExpectedFloat#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1575
1576 #[allow(clippy::cast_possible_truncation)]
1577 if value.total_cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]total_cmp().(&f64::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[f64][`From<f32>`]from().(value as f32)).is_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impl#[Ordering]is_eq().() {
1578 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#::F32rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F32#(value as f32))
1579 } else {
1580 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#::F64rust-analyzer cargo ron 0.12.0 parse/ParsedFloat#F64#(value))
1581 }
1582 }
1583
1584 fn try_from_parsed_floatrust-analyzer cargo ron 0.12.0 parse/impl#[ParsedFloat][Float]try_from_parsed_float().(parsed: ParsedFloatrust-analyzer cargo ron 0.12.0 parse/ParsedFloat#, _ron: &str) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 parse/impl#[ParsedFloat][Float]> {
1585 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(parsed)
1586 }
1587 }
1588
1589 pub enum StructTyperust-analyzer cargo ron 0.12.0 parse/StructType# {
1590 AnyTuplerust-analyzer cargo ron 0.12.0 parse/StructType#AnyTuple#,
1591 EmptyTuplerust-analyzer cargo ron 0.12.0 parse/StructType#EmptyTuple#,
1592 NewtypeTuplerust-analyzer cargo ron 0.12.0 parse/StructType#NewtypeTuple#,
1593 NonNewtypeTuplerust-analyzer cargo ron 0.12.0 parse/StructType#NonNewtypeTuple#,
1594 Namedrust-analyzer cargo ron 0.12.0 parse/StructType#Named#,
1595 Unitrust-analyzer cargo ron 0.12.0 parse/StructType#Unit#,
1596 }
1597
1598 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] // GRCOV_EXCL_LINE
1599 pub enum NewtypeModerust-analyzer cargo ron 0.12.0 parse/NewtypeMode# {
1600 NoParensMeanUnitrust-analyzer cargo ron 0.12.0 parse/NewtypeMode#NoParensMeanUnit#,
1601 InsideNewtyperust-analyzer cargo ron 0.12.0 parse/NewtypeMode#InsideNewtype#,
1602 }
1603
1604 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] // GRCOV_EXCL_LINE
1605 pub enum TupleModerust-analyzer cargo ron 0.12.0 parse/TupleMode# {
1606 ImpreciseTupleOrNewtyperust-analyzer cargo ron 0.12.0 parse/TupleMode#ImpreciseTupleOrNewtype#,
1607 DifferentiateNewtyperust-analyzer cargo ron 0.12.0 parse/TupleMode#DifferentiateNewtype#,
1608 }
1609
1610 pub enum ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#<'a> {
1611 Allocatedrust-analyzer cargo ron 0.12.0 parse/ParsedStr#Allocated#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
1612 Slicerust-analyzer cargo ron 0.12.0 parse/ParsedStr#Slice#(&'a str),
1613 }
1614
1615 pub enum ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#<'a> {
1616 Allocatedrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#Allocated#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>),
1617 Slicerust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#Slice#(&'a [u8]),
1618 }
1619
1620 impl<'a> ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#<'a> {
1621 pub fn try_from_bytesrust-analyzer cargo ron 0.12.0 parse/impl#[`ParsedStr<'a>`]try_from_bytes().(bytes: ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#<'a>) -> Resultrust-analyzer cargo ron 0.12.0 error/Result#<Selfrust-analyzer cargo ron 0.12.0 parse/impl#[`ParsedStr<'a>`], Utf8Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/error/Utf8Error#> {
1622 match bytes {
1623 ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#::Allocatedrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#Allocated#(byte_buf) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#::Allocatedrust-analyzer cargo ron 0.12.0 parse/ParsedStr#Allocated#(
1624 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8().(byte_buf).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| e.utf8_errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[FromUtf8Error]utf8_error().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
1625 )),
1626 ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#::Slicerust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#Slice#(bytes) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#::Slicerust-analyzer cargo ron 0.12.0 parse/ParsedStr#Slice#(from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(bytes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)),
1627 }
1628 }
1629 }
1630
1631 impl<'a> ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#<'a> {
1632 pub fn try_from_base64rust-analyzer cargo ron 0.12.0 parse/impl#[`ParsedByteStr<'a>`]try_from_base64().(str: &ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#<'a>) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo ron 0.12.0 parse/impl#[`ParsedByteStr<'a>`]> {
1633 // Adapted from MIT licensed Jenin Sutradhar's base 64 decoder
1634 // https://github.com/JeninSutradhar/base64-Rust-Encoder-Decoder/blob/ee1fb08cbb78024ec8cf5e786815acb239169f02/src/lib.rs#L84-L128
1635 fn try_decode_base64rust-analyzer cargo ron 0.12.0 parse/try_decode_base64().(str: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> {
1636 const CHARSETrust-analyzer cargo ron 0.12.0 parse/CHARSET.: &[u8; 64] =
1637 b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1638 const PADDINGrust-analyzer cargo ron 0.12.0 parse/PADDING.: u8 = b'=';
1639
1640 // fast reject for missing padding
1641 if (str.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().4) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 {
1642 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
1643 }
1644
1645 let bstr_no_padding = str.trim_end_matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end_matches().(char::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/convert/impl#[char][`From<u8>`]from().(PADDINGrust-analyzer cargo ron 0.12.0 parse/PADDING.)).as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().();
1646
1647 // fast reject for excessive padding
1648 if (str.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().bstr_no_padding.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().2 {
1649 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
1650 }
1651
1652 // fast reject for extraneous bytes after padding
1653 if bstr_no_padding.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&PADDINGrust-analyzer cargo ron 0.12.0 parse/PADDING.) {
1654 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
1655 }
1656
1657 // fast reject for non-ASCII
1658 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().str.is_asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_ascii().() {
1659 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
1660 }
1661
1662 let mut collected_bits = 0_u8;
1663 let mut byte_buffer = 0_u16;
1664 let mut bytes = bstr_no_padding.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().();
1665 let mut binary = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
1666
1667 'decodeloop: loop {
1668 while collected_bits rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().8 {
1669 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(nextbyte) = bytes.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/copied/impl#[`Copied<I>`][Iterator]next().() {
1670 #[allow(clippy::cast_possible_truncation)]
1671 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(idx) = CHARSETrust-analyzer cargo ron 0.12.0 parse/CHARSET..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().positionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]position().(|&x| x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().nextbyte) {
1672 byte_buffer rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitOrAssign<Self>`]bitor_assign().((idx rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().0b0011_1111) as u16) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<u8>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<u8>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shl<u8>`]shl().(10 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().collected_bits);
1673 collected_bits rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`AddAssign<Self>`]add_assign().6;
1674 } else {
1675 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
1676 }
1677 } else {
1678 break 'decodeloop;
1679 }
1680 }
1681
1682 binary.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(((0b1111_1111_0000_0000 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAnd<Self>`]bitand().byte_buffer) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`Shr<i32>`]shr().8) as u8);
1683 byte_buffer rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAndAssign<Self>`]bitand_assign().&=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAndAssign<Self>`]bitand_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`BitAndAssign<Self>`]bitand_assign().0b0000_0000_1111_1111;
1684 byte_buffer rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`ShlAssign<i32>`]shl_assign().<<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`ShlAssign<i32>`]shl_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u16][`ShlAssign<i32>`]shl_assign().8;
1685 collected_bits rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`SubAssign<Self>`]sub_assign().8;
1686 }
1687
1688 if usize::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[usize][`From<u8>`]from().(collected_bits) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().((str.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().bstr_no_padding.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().2) {
1689 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
1690 }
1691
1692 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(binary)
1693 }
1694
1695 let base64_str = match str {
1696 ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#::Allocatedrust-analyzer cargo ron 0.12.0 parse/ParsedStr#Allocated#(string) => string.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().(),
1697 ParsedStrrust-analyzer cargo ron 0.12.0 parse/ParsedStr#::Slicerust-analyzer cargo ron 0.12.0 parse/ParsedStr#Slice#(str) => str,
1698 };
1699
1700 try_decode_base64rust-analyzer cargo ron 0.12.0 parse/try_decode_base64().(base64_str).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(ParsedByteStrrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#::Allocatedrust-analyzer cargo ron 0.12.0 parse/ParsedByteStr#Allocated#)
1701 }
1702 }
1703
1704 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] // GRCOV_EXCL_LINE
1705 enum EscapeEncodingrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding# {
1706 Binaryrust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#Binary#,
1707 Utf8rust-analyzer cargo ron 0.12.0 parse/EscapeEncoding#Utf8#,
1708 }
1709
1710 enum EscapeCharacterrust-analyzer cargo ron 0.12.0 parse/EscapeCharacter# {
1711 Asciirust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Ascii#(u8),
1712 Utf8rust-analyzer cargo ron 0.12.0 parse/EscapeCharacter#Utf8#(char),
1713 }
1714
1715 #[cfg(test)]
1716 mod testsrust-analyzer cargo ron 0.12.0 parse/tests/ {
1717 use superrust-analyzer cargo ron 0.12.0 parse/::*;
1718
1719 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1720 fn decode_x10rust-analyzer cargo ron 0.12.0 parse/tests/decode_x10().() {
1721 let mut bytes = Parserrust-analyzer cargo ron 0.12.0 parse/Parser#::newrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]new().("10").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1722 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.decode_ascii_escaperust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]decode_ascii_escape().(), Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(b'\x10'));
1723 }
1724
1725 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1726 fn track_prior_wsrust-analyzer cargo ron 0.12.0 parse/tests/track_prior_ws().() {
1727 const SOURCErust-analyzer cargo ron 0.12.0 parse/tests/SOURCE.: &str = " /*hey*/ 42 /*bye*/ 24 ";
1728 let mut bytes = Parserrust-analyzer cargo ron 0.12.0 parse/Parser#::newrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]new().(SOURCErust-analyzer cargo ron 0.12.0 parse/tests/SOURCE.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1729
1730 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(), "42 /*bye*/ 24 ");
1731 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(), SOURCErust-analyzer cargo ron 0.12.0 parse/tests/SOURCE.);
1732
1733 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1734
1735 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(), "42 /*bye*/ 24 ");
1736 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(), SOURCErust-analyzer cargo ron 0.12.0 parse/tests/SOURCE.);
1737
1738 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]integer().::<u8>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 42);
1739
1740 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(), " /*bye*/ 24 ");
1741 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(), SOURCErust-analyzer cargo ron 0.12.0 parse/tests/SOURCE.);
1742
1743 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1744 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1745
1746 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(), "24 ");
1747 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(), " /*bye*/ 24 ");
1748
1749 let mut bytes = Parserrust-analyzer cargo ron 0.12.0 parse/Parser#::newrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]new().("42").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1750 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1751 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1752 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(), "42");
1753 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(), "42");
1754 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]integer().::<u8>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 42);
1755 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1756 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1757 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(), "");
1758 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(), "");
1759
1760 let mut bytes = Parserrust-analyzer cargo ron 0.12.0 parse/Parser#::newrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]new().(" 42 ").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1761 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1762 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1763 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(), "42 ");
1764 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(), " 42 ");
1765 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]integer().::<u8>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 42);
1766 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1767 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1768 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(), "");
1769 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(), " ");
1770
1771 let mut bytes = Parserrust-analyzer cargo ron 0.12.0 parse/Parser#::newrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]new().(" 42 //").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1772 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1773 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1774 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(), "42 //");
1775 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(), " 42 //");
1776 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.integerrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]integer().::<u8>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 42);
1777 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1778 bytes.skip_wsrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]skip_ws().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1779 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]src().(), "");
1780 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bytes.pre_ws_srcrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]pre_ws_src().(), " //");
1781 }
1782
1783 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1784 fn parser_cursor_eq_cmprust-analyzer cargo ron 0.12.0 parse/tests/parser_cursor_eq_cmp().() {
1785 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(
1786 ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
1787 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: 42,
1788 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: 42,
1789 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: 42
1790 } == ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
1791 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: 42,
1792 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: 24,
1793 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: 24
1794 }
1795 );
1796 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(
1797 ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
1798 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: 42,
1799 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: 42,
1800 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: 42
1801 } != ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
1802 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: 24,
1803 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: 42,
1804 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: 42
1805 }
1806 );
1807
1808 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(
1809 ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
1810 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: 42,
1811 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: 42,
1812 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: 42
1813 } <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
1814 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: 43,
1815 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: 24,
1816 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: 24
1817 }
1818 );
1819 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(
1820 ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
1821 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: 42,
1822 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: 42,
1823 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: 42
1824 } >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). ParserCursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor# {
1825 cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#cursor.: 41,
1826 pre_ws_cursorrust-analyzer cargo ron 0.12.0 parse/ParserCursor#pre_ws_cursor.: 24,
1827 last_ws_lenrust-analyzer cargo ron 0.12.0 parse/ParserCursor#last_ws_len.: 24
1828 }
1829 );
1830 }
1831
1832 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1833 fn empty_src_is_not_a_floatrust-analyzer cargo ron 0.12.0 parse/tests/empty_src_is_not_a_float().() {
1834 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().Parserrust-analyzer cargo ron 0.12.0 parse/Parser#::newrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]new().("").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().next_bytes_is_floatrust-analyzer cargo ron 0.12.0 parse/impl#[`Parser<'a>`]next_bytes_is_float().());
1835 }
1836
1837 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1838 fn base64_deprecation_errorrust-analyzer cargo ron 0.12.0 parse/tests/base64_deprecation_error().() {
1839 let err = craterust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<bytesrust-analyzer cargo bytes 1.10.1 crate/::Bytesrust-analyzer cargo bytes 1.10.1 bytes/Bytes#>("\"SGVsbG8gcm9uIQ==\"").unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().();
1840
1841 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1842 err,
1843 SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
1844 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidValueForTyperust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType# {
1845 expectedrust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType#expected.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("the Rusty byte string b\"Hello ron!\""),
1846 foundrust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType#found.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("the ambiguous base64 string \"SGVsbG8gcm9uIQ==\"")
1847 },
1848 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
1849 startrust-analyzer cargo ron 0.12.0 error/Span#start.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 2 },
1850 endrust-analyzer cargo ron 0.12.0 error/Span#end.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 19 },
1851 }
1852 }
1853 );
1854
1855 let err = craterust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<bytesrust-analyzer cargo bytes 1.10.1 crate/::Bytesrust-analyzer cargo bytes 1.10.1 bytes/Bytes#>("r\"SGVsbG8gcm9uIQ==\"").unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().();
1856
1857 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", err.coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.), "Expected the Rusty byte string b\"Hello ron!\" but found the ambiguous base64 string \"SGVsbG8gcm9uIQ==\" instead");
1858
1859 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1860 craterust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<bytesrust-analyzer cargo bytes 1.10.1 crate/::Bytesrust-analyzer cargo bytes 1.10.1 bytes/Bytes#>("\"invalid=\"").unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(),
1861 SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
1862 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidValueForTyperust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType# {
1863 expectedrust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType#expected.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("the Rusty byte string b\"\\x8a{\\xda\\x96\\'\""),
1864 foundrust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType#found.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("the ambiguous base64 string \"invalid=\"")
1865 },
1866 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
1867 startrust-analyzer cargo ron 0.12.0 error/Span#start.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 2 },
1868 endrust-analyzer cargo ron 0.12.0 error/Span#end.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 11 },
1869 }
1870 }
1871 );
1872
1873 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1874 craterust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<bytesrust-analyzer cargo bytes 1.10.1 crate/::Bytesrust-analyzer cargo bytes 1.10.1 bytes/Bytes#>("r\"invalid=\"").unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(),
1875 SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
1876 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::InvalidValueForTyperust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType# {
1877 expectedrust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType#expected.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("the Rusty byte string b\"\\x8a{\\xda\\x96\\'\""),
1878 foundrust-analyzer cargo ron 0.12.0 error/Error#InvalidValueForType#found.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("the ambiguous base64 string \"invalid=\"")
1879 },
1880 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
1881 startrust-analyzer cargo ron 0.12.0 error/Span#start.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 3 },
1882 endrust-analyzer cargo ron 0.12.0 error/Span#end.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 12 },
1883 }
1884 }
1885 );
1886
1887 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1888 craterust-analyzer cargo ron 0.12.0 crate/::from_strrust-analyzer cargo ron 0.12.0 de/from_str().::<bytesrust-analyzer cargo bytes 1.10.1 crate/::Bytesrust-analyzer cargo bytes 1.10.1 bytes/Bytes#>("r\"invalid\"").unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(),
1889 SpannedErrorrust-analyzer cargo ron 0.12.0 error/SpannedError# {
1890 coderust-analyzer cargo ron 0.12.0 error/SpannedError#code.: Errorrust-analyzer cargo ron 0.12.0 error/Error#::ExpectedByteStringrust-analyzer cargo ron 0.12.0 error/Error#ExpectedByteString#,
1891 spanrust-analyzer cargo ron 0.12.0 error/SpannedError#span.: Spanrust-analyzer cargo ron 0.12.0 error/Span# {
1892 startrust-analyzer cargo ron 0.12.0 error/Span#start.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 3 },
1893 endrust-analyzer cargo ron 0.12.0 error/Span#end.: Positionrust-analyzer cargo ron 0.12.0 error/Position# { linerust-analyzer cargo ron 0.12.0 error/Position#line.: 1, colrust-analyzer cargo ron 0.12.0 error/Position#col.: 11 },
1894 }
1895 }
1896 );
1897 }
1898 }