From: Valentine Wallace Date: Sun, 9 Apr 2023 20:51:55 +0000 (-0400) Subject: Extract read/write variants from impl_for_vec X-Git-Tag: v0.0.115~5^2~13 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=6d6a86c92c1e190379d16282852c4d29a763f3aa;p=rust-lightning Extract read/write variants from impl_for_vec We'll need to (de)serialize vecs of BlindedPaths differently based on whether we're writing or reading --- diff --git a/lightning/src/util/ser.rs b/lightning/src/util/ser.rs index 8056f3bed..566c74752 100644 --- a/lightning/src/util/ser.rs +++ b/lightning/src/util/ser.rs @@ -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: &mut R) -> Result { @@ -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 { #[inline]