Skip to main content

check_wire_type

Function check_wire_type 

Source
pub fn check_wire_type(tag: Tag, expected: WireType) -> Result<(), DecodeError>
Expand description

Verify a decoded tag carries the expected wire type.

Generated merge_field / view-decode arms call this once per field arm before reading the payload, replacing an inline comparison + error construction at every arm. The mismatch path is delegated to the #[cold] wire_type_mismatch so the hot decode loop carries only the comparison.

§Errors

Returns DecodeError::WireTypeMismatch when tag’s wire type is not expected.