(de: &mut Deserializer)
| 454 | |
| 455 | impl Deserialize for FuncGadget { |
| 456 | fn deserialize(de: &mut Deserializer) -> eyre::Result<Self> { |
| 457 | de.eat_token("(")?; |
| 458 | let name = de.parse_string()?; |
| 459 | // parse arg idents |
| 460 | de.consume_token_until("arg_idents: [")?; |
| 461 | let mut arg_idents = vec![]; |
| 462 | while de.peek_char()? == '\"' { |
| 463 | let ident = de.parse_string()?; |
| 464 | arg_idents.push(ident.to_owned()); |
| 465 | if de.peek_char()? == ',' { |
| 466 | de.eat_token(",")?; |
| 467 | } |
| 468 | } |
| 469 | // parse arg types |
| 470 | de.consume_token_until("arg_types: [")?; |
| 471 | let mut arg_types = vec![]; |
| 472 | while de.peek_char()? == '\"' { |
| 473 | let arg_type = de.parse_string()?; |
| 474 | arg_types.push(arg_type.to_owned()); |
| 475 | if de.peek_char()? == ',' { |
| 476 | de.eat_token(",")?; |
| 477 | } |
| 478 | } |
| 479 | // parse ret type |
| 480 | de.consume_token_until("ret_type: ")?; |
| 481 | let ret_type = if de.is_next_token("Some(") { |
| 482 | de.eat_token("Some(")?; |
| 483 | de.parse_string()? |
| 484 | } else { |
| 485 | "void" |
| 486 | }; |
| 487 | // parse alias arg types. |
| 488 | de.consume_token_until("alias_arg_types: [")?; |
| 489 | let mut alias_arg_types = vec![]; |
| 490 | while de.peek_char()? == '\"' { |
| 491 | let arg_type = de.parse_string()?; |
| 492 | alias_arg_types.push(arg_type.to_owned()); |
| 493 | if de.peek_char()? == ',' { |
| 494 | de.eat_token(",")?; |
| 495 | } |
| 496 | } |
| 497 | // parse alias ret type |
| 498 | de.consume_token_until("alias_ret_type: ")?; |
| 499 | let alias_ret_type = if de.is_next_token("Some(") { |
| 500 | de.eat_token("Some(")?; |
| 501 | de.parse_string()? |
| 502 | } else { |
| 503 | "void" |
| 504 | }; |
| 505 | Ok(Self { |
| 506 | name: name.to_owned(), |
| 507 | arg_idents, |
| 508 | arg_types, |
| 509 | alias_arg_types, |
| 510 | ret_type: ret_type.to_owned(), |
| 511 | alias_ret_type: alias_ret_type.to_owned(), |
| 512 | }) |
| 513 | } |
nothing calls this directly
no test coverage detected