1 /// Fixed size integers. 2 pub(crate) trait ProtobufFixed { 3 /// Size of this fixed type in bytes. 4 const LEN: u32; 5 } 6 7 impl ProtobufFixed for u32 { 8 const LEN: u32 = 4; 9 } 10 11 impl ProtobufFixed for i32 { 12 const LEN: u32 = 4; 13 } 14 15 impl ProtobufFixed for u64 { 16 const LEN: u32 = 8; 17 } 18 19 impl ProtobufFixed for i64 { 20 const LEN: u32 = 8; 21 } 22 23 impl ProtobufFixed for f32 { 24 const LEN: u32 = 4; 25 } 26 27 impl ProtobufFixed for f64 { 28 const LEN: u32 = 8; 29 } 30 31 /// Technically `bool` is not fixed, but it can be considered as fixed 32 /// for the purpose of encoding. 33 impl ProtobufFixed for bool { 34 const LEN: u32 = 1; 35 } 36