]> git.bitcoin.ninja Git - rust-lightning/commitdiff
No-export `&self` methods on non-cloneable enum(s) 2022-12-113-bindings-upstream
authorMatt Corallo <git@bluematt.me>
Fri, 23 Dec 2022 20:44:24 +0000 (20:44 +0000)
committerMatt Corallo <git@bluematt.me>
Sun, 25 Dec 2022 00:58:19 +0000 (00:58 +0000)
Specifically, `OnionMessageContents` is a non-cloneable enum, which
isn't stored opaque so we cannot call `&self` methods on it.
Because its methods aren't critical to the API for now, we simply
no-export them rather than trying to work out an alternative
approach.

lightning/src/onion_message/packet.rs

index 3222c08a39263c7d1ab78113f2987e505257059c..5ff226387107ae23f839dc376d1db15d73c8a345 100644 (file)
@@ -118,6 +118,8 @@ pub enum OnionMessageContents<T: CustomOnionMessageContents> {
 
 impl<T: CustomOnionMessageContents> OnionMessageContents<T> {
        /// Returns the type that was used to decode the message payload.
+       ///
+       /// (C-not exported) as methods on non-cloneable enums are not currently exportable
        pub fn tlv_type(&self) -> u64 {
                match self {
                        &OnionMessageContents::Custom(ref msg) => msg.tlv_type(),
@@ -125,6 +127,7 @@ impl<T: CustomOnionMessageContents> OnionMessageContents<T> {
        }
 }
 
+/// (C-not exported) as methods on non-cloneable enums are not currently exportable
 impl<T: CustomOnionMessageContents> Writeable for OnionMessageContents<T> {
        fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
                match self {