From: Matt Corallo Date: Fri, 24 Sep 2021 18:44:32 +0000 (+0000) Subject: Make the Type trait cloneable as its contained deep in nested structs X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=b6a63c8a9f79c2f7078c857cf95f8209f1d1c89a;p=rust-lightning Make the Type trait cloneable as its contained deep in nested structs --- diff --git a/lightning/src/ln/wire.rs b/lightning/src/ln/wire.rs index 1191a8d3d..3d68dfa68 100644 --- a/lightning/src/ln/wire.rs +++ b/lightning/src/ln/wire.rs @@ -276,13 +276,13 @@ pub(crate) use self::encode::Encode; /// Defines a type identifier for sending messages over the wire. /// /// Messages implementing this trait specify a type and must be [`Writeable`]. -pub trait Type: core::fmt::Debug + Writeable { +pub trait Type: core::fmt::Debug + Writeable + Clone { /// Returns the type identifying the message payload. fn type_id(&self) -> u16; } #[cfg(test)] -pub trait Type: core::fmt::Debug + Writeable + PartialEq { +pub trait Type: core::fmt::Debug + Writeable + Clone + PartialEq { fn type_id(&self) -> u16; } @@ -292,12 +292,12 @@ impl Type for () { } #[cfg(test)] -impl Type for T where T: Encode { +impl Type for T where T: Encode { fn type_id(&self) -> u16 { T::TYPE } } #[cfg(not(test))] -impl Type for T where T: Encode { +impl Type for T where T: Encode { fn type_id(&self) -> u16 { T::TYPE } } @@ -583,7 +583,7 @@ mod tests { } } - #[derive(Eq, PartialEq, Debug)] + #[derive(Clone, Eq, PartialEq, Debug)] struct TestCustomMessage {} const CUSTOM_MESSAGE_TYPE : u16 = 9000;