macro_rules! sum_encoded_size {
($($val:expr),+) => { ... };
}Expand description
Given a list of CompactEncoding things, sum the result of calling
CompactEncoding::encoded_size on all of them.
Note this is macro is useful when your arguments have differing types.
let foo: Ipv4Addr = "0.0.0.0".parse()?;
let bar = 42u64;
let qux = "hello?";
let result = sum_encoded_size!(foo, bar, qux);
assert_eq!(result, 12);If you want to use this within a non-result context you can do
let bar = 42u64;
let result = (|| Ok::<usize, EncodingError>(sum_encoded_size!(bar)))().unwrap();
assert_eq!(result, 1);