From 6d6a86c92c1e190379d16282852c4d29a763f3aa Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Sun, 9 Apr 2023 16:51:55 -0400 Subject: [PATCH] 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 --- lightning/src/util/ser.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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] -- 2.39.5