(
context: &mut ReadContext,
field_type: &FieldType,
read_ref_flag: bool,
_is_field: bool,
type_info: &Option<Rc<crate::TypeInfo>>,
)
| 456 | #[inline(never)] |
| 457 | #[allow(unreachable_code)] |
| 458 | fn skip_value( |
| 459 | context: &mut ReadContext, |
| 460 | field_type: &FieldType, |
| 461 | read_ref_flag: bool, |
| 462 | _is_field: bool, |
| 463 | type_info: &Option<Rc<crate::TypeInfo>>, |
| 464 | ) -> Result<(), Error> { |
| 465 | if read_ref_flag { |
| 466 | let ref_flag = context.reader.read_i8()?; |
| 467 | if ref_flag == (RefFlag::Null as i8) { |
| 468 | return Ok(()); |
| 469 | } |
| 470 | if ref_flag == (RefFlag::Ref as i8) { |
| 471 | // Reference to already-seen object, skip the reference index |
| 472 | let _ref_index = context.reader.read_var_u32()?; |
| 473 | return Ok(()); |
| 474 | } |
| 475 | // RefValue (0) or NotNullValue (-1) means we need to read the actual object |
| 476 | } |
| 477 | let type_id_num = field_type.type_id; |
| 478 | |
| 479 | if type_id_num == types::UNKNOWN { |
| 480 | return skip_any_value(context, false); |
| 481 | } |
| 482 | |
| 483 | // Handle user-defined types (struct/enum/ext/union) |
| 484 | if types::is_user_type(type_id_num) { |
| 485 | if type_id_num == types::COMPATIBLE_STRUCT |
| 486 | || type_id_num == types::STRUCT |
| 487 | || type_id_num == types::NAMED_STRUCT |
| 488 | || type_id_num == types::NAMED_COMPATIBLE_STRUCT |
| 489 | { |
| 490 | return skip_struct(context, type_id_num, type_info); |
| 491 | } else if type_id_num == types::ENUM || type_id_num == types::NAMED_ENUM { |
| 492 | let _ordinal = context.reader.read_var_u32()?; |
| 493 | return Ok(()); |
| 494 | } else if type_id_num == types::UNION |
| 495 | || type_id_num == types::TYPED_UNION |
| 496 | || type_id_num == types::NAMED_UNION |
| 497 | { |
| 498 | let _ordinal = context.reader.read_var_u32()?; |
| 499 | return skip_any_value(context, true); |
| 500 | } else if type_id_num == types::EXT || type_id_num == types::NAMED_EXT { |
| 501 | return skip_ext(context, type_id_num, type_info); |
| 502 | } else { |
| 503 | return Err(Error::type_error(format!( |
| 504 | "Unknown type id: {} (type_info provided: {})", |
| 505 | type_id_num, |
| 506 | type_info.is_some() |
| 507 | ))); |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | // Match on built-in types (ordered by TypeId enum values) |
| 512 | match type_id_num { |
| 513 | // ============ UNKNOWN ============ |
| 514 | types::UNKNOWN => { |
| 515 | // UNKNOWN is used for polymorphic types in cross-language serialization |
no test coverage detected