From ebb55ff2aae55146239ff8fecd79c02ea4c3580f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 2 Feb 2020 21:25:33 -0500 Subject: [PATCH] Expose VecWriter outside of util::ser since peer_handler uses it --- lightning/src/ln/peer_handler.rs | 13 +------------ lightning/src/util/ser.rs | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 5838b782f..4809cecc4 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -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 where CM::Target logger: Arc, } -struct VecWriter(Vec); -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()); diff --git a/lightning/src/util/ser.rs b/lightning/src/util/ser.rs index 96f8cea04..e773c4f2d 100644 --- a/lightning/src/util/ser.rs +++ b/lightning/src/util/ser.rs @@ -57,7 +57,7 @@ impl<'a, W: Writer + 'a> Write for WriterWriteAdaptor<'a, W> { } } -struct VecWriter(Vec); +pub(crate) struct VecWriter(pub Vec); impl Writer for VecWriter { fn write_all(&mut self, buf: &[u8]) -> Result<(), ::std::io::Error> { self.0.extend_from_slice(buf); -- 2.39.5