From dcf994d517a43d5cd9d34433b8aaf578717d25a3 Mon Sep 17 00:00:00 2001 From: kibbles Date: Sun, 20 Nov 2016 21:44:23 -0500 Subject: [PATCH] Updated 'encode' return value to Result, removed parameter passing buffer --- src/io/frame.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/io/frame.rs b/src/io/frame.rs index 0686614d4..f34ee3f85 100644 --- a/src/io/frame.rs +++ b/src/io/frame.rs @@ -243,7 +243,7 @@ pub trait Codec { /// This method will encode `msg` into the byte buffer provided by `buf`. /// The `buf` provided is an internal buffer of the `Framed` instance and /// will be written out when possible. - fn encode(&mut self, msg: Self::Out, buf: &mut Vec); + fn encode(&mut self, msg: Self::Out) -> Result, io::Error>; } /// A `Stream` interface to an underlying `Io` object, using the `Decode` trait @@ -366,7 +366,7 @@ impl Sink for Framed { } } - self.codec.encode(item, &mut self.wr); + self.wr = self.codec.encode(item).unwrap(); Ok(AsyncSink::Ready) }