MCPcopy Create free account
hub / github.com/dprint/jsonc-parser / drain_array

Function drain_array

src/serde.rs:263–280  ·  view source on GitHub ↗

Consumes remaining array elements and the closing `]` when a visitor (e.g. for a tuple) stops reading before the end of the array.

(parser: &mut JsoncParser)

Source from the content-addressed store, hash-verified

261/// Consumes remaining array elements and the closing `]` when a visitor
262/// (e.g. for a tuple) stops reading before the end of the array.
263fn drain_array(parser: &mut JsoncParser) -> Result<(), ParseError> {
264 loop {
265 match parser.scan_array_comma()? {
266 Some(Token::CloseBracket) => return Ok(()),
267 Some(token) => {
268 parser.put_back(token);
269 <::serde::de::IgnoredAny as ::serde::Deserialize>::deserialize(&mut *parser)?;
270 }
271 None => {
272 return Err(
273 parser
274 .scanner
275 .create_error_for_current_token(ParseErrorKind::UnterminatedArray),
276 );
277 }
278 }
279 }
280}
281
282struct ScannerSeqAccess<'a, 'b> {
283 parser: &'b mut JsoncParser<'a>,

Callers 2

deserialize_tokenFunction · 0.85
tuple_variantMethod · 0.85

Calls 3

scan_array_commaMethod · 0.80
put_backMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…