Skip to content

Commit 6d6a86c

Browse files
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
1 parent ed4348f commit 6d6a86c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lightning/src/util/ser.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ where T: Readable + Eq + Hash
749749
}
750750

751751
// Vectors
752-
macro_rules! impl_for_vec {
752+
macro_rules! impl_writeable_for_vec {
753753
($ty: ty $(, $name: ident)*) => {
754754
impl<$($name : Writeable),*> Writeable for Vec<$ty> {
755755
#[inline]
@@ -761,7 +761,10 @@ macro_rules! impl_for_vec {
761761
Ok(())
762762
}
763763
}
764-
764+
}
765+
}
766+
macro_rules! impl_readable_for_vec {
767+
($ty: ty $(, $name: ident)*) => {
765768
impl<$($name : Readable),*> Readable for Vec<$ty> {
766769
#[inline]
767770
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
@@ -777,6 +780,12 @@ macro_rules! impl_for_vec {
777780
}
778781
}
779782
}
783+
macro_rules! impl_for_vec {
784+
($ty: ty $(, $name: ident)*) => {
785+
impl_writeable_for_vec!($ty $(, $name)*);
786+
impl_readable_for_vec!($ty $(, $name)*);
787+
}
788+
}
780789

781790
impl Writeable for Vec<u8> {
782791
#[inline]

0 commit comments

Comments
 (0)