Extract read/write variants from impl_for_vec
[rust-lightning] / lightning / src / util / ser.rs
index 8056f3bed35569e952c6897a4b999b6e2bf3b1fd..566c74752d7dbd34ea3f65a185bf874e97c4cb23 100644 (file)
@@ -749,7 +749,7 @@ where T: Readable + Eq + Hash
 }
 
 // Vectors
-macro_rules! impl_for_vec {
+macro_rules! impl_writeable_for_vec {
        ($ty: ty $(, $name: ident)*) => {
                impl<$($name : Writeable),*> Writeable for Vec<$ty> {
                        #[inline]
@@ -761,7 +761,10 @@ macro_rules! impl_for_vec {
                                Ok(())
                        }
                }
-
+       }
+}
+macro_rules! impl_readable_for_vec {
+       ($ty: ty $(, $name: ident)*) => {
                impl<$($name : Readable),*> Readable for Vec<$ty> {
                        #[inline]
                        fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
@@ -777,6 +780,12 @@ macro_rules! impl_for_vec {
                }
        }
 }
+macro_rules! impl_for_vec {
+       ($ty: ty $(, $name: ident)*) => {
+               impl_writeable_for_vec!($ty $(, $name)*);
+               impl_readable_for_vec!($ty $(, $name)*);
+       }
+}
 
 impl Writeable for Vec<u8> {
        #[inline]