-macro_rules! impl_writeable_len_match {
- ($struct: ident, $cmp: tt, ($calc_len: expr), {$({$match: pat, $length: expr}),*}, {$($field:ident),*}) => {
- impl Writeable for $struct {
- fn write<W: Writer>(&self, w: &mut W) -> Result<(), $crate::io::Error> {
- let len = match *self {
- $($match => $length,)*
- };
- w.size_hint(len);
- #[cfg(any(test, feature = "fuzztarget"))]
- {
- // In tests, assert that the hard-coded length matches the actual one
- let mut len_calc = ::util::ser::LengthCalculatingWriter(0);
- $( self.$field.write(&mut len_calc).expect("No in-memory data may fail to serialize"); )*
- assert!(len_calc.0 $cmp len);
- assert_eq!(len_calc.0, self.serialized_length());
- }
+
+macro_rules! impl_writeable {
+ ($st:ident, {$($field:ident),*}) => {
+ impl $crate::util::ser::Writeable for $st {
+ fn write<W: $crate::util::ser::Writer>(&self, w: &mut W) -> Result<(), $crate::io::Error> {