From 4777efdfaadaaba041bbfe582180fcbde2a4850e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lena=20Hellstr=C3=B6m?= Date: Sun, 23 Jul 2017 23:58:29 -0500 Subject: [PATCH] take reader and writer by value (#200) --- src/internal.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/internal.rs b/src/internal.rs index b0efe05..78e4cfa 100644 --- a/src/internal.rs +++ b/src/internal.rs @@ -121,7 +121,7 @@ impl serde::ser::Error for Error { /// If this returns an `Error` (other than SizeLimit), assume that the /// writer is in an invalid state, as writing could bail out in the middle of /// serializing. -pub fn serialize_into(writer: &mut W, value: &T, size_limit: S) -> Result<()> +pub fn serialize_into(writer: W, value: &T, size_limit: S) -> Result<()> where W: Write, T: serde::Serialize, S: SizeLimit, E: ByteOrder { if let Some(limit) = size_limit.limit() { @@ -212,7 +212,7 @@ pub fn serialized_size_bounded(value: &T, max: u64) -> Option /// If this returns an `Error`, assume that the buffer that you passed /// in is in an invalid state, as the error could be returned during any point /// in the reading. -pub fn deserialize_from(reader: &mut R, size_limit: S) -> Result +pub fn deserialize_from(reader: R, size_limit: S) -> Result where R: Read, T: serde::de::DeserializeOwned, S: SizeLimit, E: ByteOrder { let reader = ::de::read::IoReader::new(reader);