]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Expose VecWriter outside of util::ser since peer_handler uses it
authorMatt Corallo <git@bluematt.me>
Mon, 3 Feb 2020 02:25:33 +0000 (21:25 -0500)
committerMatt Corallo <git@bluematt.me>
Mon, 3 Feb 2020 02:26:33 +0000 (21:26 -0500)
lightning/src/ln/peer_handler.rs
lightning/src/util/ser.rs

index 5838b782f4d4124a906d07f7d8e4c0cfad65eb8d..4809cecc4ad7cb008bf7b69bf9cf2723109c781d 100644 (file)
@@ -12,7 +12,7 @@ use ln::features::InitFeatures;
 use ln::msgs;
 use ln::msgs::ChannelMessageHandler;
 use ln::channelmanager::{SimpleArcChannelManager, SimpleRefChannelManager};
-use util::ser::{Writeable, Writer, Readable};
+use util::ser::{Writeable, Readable, VecWriter};
 use ln::peer_channel_encryptor::{PeerChannelEncryptor,NextNoiseStep};
 use util::byte_utils;
 use util::events::{MessageSendEvent, MessageSendEventsProvider};
@@ -191,17 +191,6 @@ pub struct PeerManager<Descriptor: SocketDescriptor, CM: Deref> where CM::Target
        logger: Arc<Logger>,
 }
 
-struct VecWriter(Vec<u8>);
-impl Writer for VecWriter {
-       fn write_all(&mut self, buf: &[u8]) -> Result<(), ::std::io::Error> {
-               self.0.extend_from_slice(buf);
-               Ok(())
-       }
-       fn size_hint(&mut self, size: usize) {
-               self.0.reserve_exact(size);
-       }
-}
-
 macro_rules! encode_msg {
        ($msg: expr, $msg_code: expr) => {{
                let mut msg = VecWriter(Vec::new());
index 96f8cea04c925985925058b51c664d1ef773a289..e773c4f2d9c9294aa548cbb01fb02a75a480bfac 100644 (file)
@@ -57,7 +57,7 @@ impl<'a, W: Writer + 'a> Write for WriterWriteAdaptor<'a, W> {
        }
 }
 
-struct VecWriter(Vec<u8>);
+pub(crate) struct VecWriter(pub Vec<u8>);
 impl Writer for VecWriter {
        fn write_all(&mut self, buf: &[u8]) -> Result<(), ::std::io::Error> {
                self.0.extend_from_slice(buf);