Skip to main content

is_location_value

Function is_location_value 

Source
fn is_location_value(bytes: &[u8]) -> bool
Expand description

Whether bytes is exactly the wire form of a Location — two consecutive varints and nothing after them.

decode_parameters builds this value by reading two varints and re-serialising them, so every value it produces satisfies this. A value built in memory need not, and the encode arm writes these bytes verbatim because a Location carries no length of its own. Without this check a caller could hand over one varint, or three, and the codec would put a frame on the wire that its own decoder answers with an error.