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

Method tuple_variant

src/serde.rs:383–406  ·  view source on GitHub ↗
(self, _len: usize, visitor: V)

Source from the content-addressed store, hash-verified

381 }
382
383 fn tuple_variant<V: Visitor<'de>>(self, _len: usize, visitor: V) -> Result<V::Value, Self::Error> {
384 match self.parser.scan()? {
385 Some(Token::OpenBracket) => {
386 self.parser.enter_container()?;
387 let finished = Cell::new(false);
388 let result = visitor.visit_seq(ScannerSeqAccess {
389 parser: self.parser,
390 first: true,
391 finished: &finished,
392 });
393 if result.is_ok() && !finished.get() {
394 if let Err(e) = drain_array(self.parser) {
395 self.parser.exit_container();
396 return Err(e);
397 }
398 }
399 self.parser.exit_container();
400 result
401 }
402 _ => Err(ParseError::custom_err(
403 "expected an array for tuple variant".to_string(),
404 )),
405 }
406 }
407
408 fn struct_variant<V: Visitor<'de>>(
409 self,

Callers

nothing calls this directly

Calls 5

drain_arrayFunction · 0.85
enter_containerMethod · 0.80
exit_containerMethod · 0.80
scanMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected