| /// Fixed size integers. |
| pub(crate) trait ProtobufFixed { |
| /// Size of this fixed type in bytes. |
| const LEN: u32; |
| } |
| |
| impl ProtobufFixed for u32 { |
| const LEN: u32 = 4; |
| } |
| |
| impl ProtobufFixed for i32 { |
| const LEN: u32 = 4; |
| } |
| |
| impl ProtobufFixed for u64 { |
| const LEN: u32 = 8; |
| } |
| |
| impl ProtobufFixed for i64 { |
| const LEN: u32 = 8; |
| } |
| |
| impl ProtobufFixed for f32 { |
| const LEN: u32 = 4; |
| } |
| |
| impl ProtobufFixed for f64 { |
| const LEN: u32 = 8; |
| } |
| |
| /// Technically `bool` is not fixed, but it can be considered as fixed |
| /// for the purpose of encoding. |
| impl ProtobufFixed for bool { |
| const LEN: u32 = 1; |
| } |