Skip to main content

assert_consecutive

Macro assert_consecutive 

Source
macro_rules! assert_consecutive {
    ($($tag:ident),+ $(,)?) => { ... };
}
Expand description

Assert that the listed tags are consecutive, in the order given.

Every family below is addressed by arithmetic rather than by name: push_datum writes first + n for a payload of n bytes, and read_signed_varint/read_unsigned_varint invert that by subtraction. A variant inserted into the middle of a family, or two members swapped, silently changes how many bytes a tag claims, which corrupts the datum rather than failing to compile. These assertions turn that into a compile error at the definition.