StaticunsortedStaticinvalidStaticinvalidStaticunsupportedStaticunknownStaticintegerError for integer values that exceed type-specific bounds.
This error is part of encoder defense-in-depth validation: even if a value somehow bypasses value constructor validation, the encoder re-validates integer ranges before writing bytes. This ensures wire format correctness.
The integer type name (e.g., "u8", "i64")
The out-of-range value that failed validation
The minimum valid value for the type
The maximum valid value for the type
EncodeError describing the range violation
StaticnotError for non-integer number values in integer types.
This error is part of encoder defense-in-depth validation: the encoder validates that floating-point numbers like 3.14 are rejected for integer type codes. This ensures only whole numbers are encoded in integer fields.
The integer type name (e.g., "u32", "i64")
The non-integer number that failed validation
EncodeError describing the non-integer value
Error type for encoding failures.
Provides factory methods for specific error conditions encountered during encoding. All EncodeError instances include a descriptive message property.
Example
Handling encode errors:
Remarks
Encode errors indicate programmer errors (invalid input structure), not I/O failures. Common errors include unsorted struct fields, invalid field IDs, and unsupported types.