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=0d0c33c2a9844f244e45923155987daa50d2baaf;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 cbf5c77d6..acbc36e65 100644 --- a/lightning/src/ln/wire.rs +++ b/lightning/src/ln/wire.rs @@ -271,13 +271,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; } @@ -287,12 +287,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 } } @@ -574,7 +574,7 @@ mod tests { } } - #[derive(Eq, PartialEq, Debug)] + #[derive(Clone, Eq, PartialEq, Debug)] struct TestCustomMessage {} const CUSTOM_MESSAGE_TYPE : u16 = 9000;