Add MaxEncodedLen to implement_fixed! (#10768)

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2022-02-01 14:45:16 +01:00
committed by GitHub
parent ba3255376e
commit dbb3f24e3e
@@ -369,6 +369,7 @@ macro_rules! implement_fixed {
Default, Default,
Copy, Copy,
Clone, Clone,
codec::MaxEncodedLen,
PartialEq, PartialEq,
Eq, Eq,
PartialOrd, PartialOrd,
@@ -667,6 +668,15 @@ macro_rules! implement_fixed {
assert!($name::DIV > 0); assert!($name::DIV > 0);
} }
#[test]
fn has_max_encoded_len() {
struct AsMaxEncodedLen<T: codec::MaxEncodedLen> {
_data: T,
}
let _ = AsMaxEncodedLen { _data: $name::min_value() };
}
#[test] #[test]
fn from_i129_works() { fn from_i129_works() {
let a = I129 { value: 1, negative: true }; let a = I129 { value: 1, negative: true };