From 12bf34f8868fd43ba07a05c5718a568738807ed6 Mon Sep 17 00:00:00 2001 From: Hadrien Grasland Date: Fri, 20 Sep 2019 11:58:05 +0200 Subject: [PATCH] Take writer by value --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9c24661..de36e49 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -72,10 +72,10 @@ pub mod abomonated; /// ``` /// #[inline(always)] -pub unsafe fn encode(typed: &T, write: &mut W) -> IOResult<()> { +pub unsafe fn encode(typed: &T, mut write: W) -> IOResult<()> { let slice = std::slice::from_raw_parts(mem::transmute(typed), mem::size_of::()); write.write_all(slice)?; - typed.entomb(write) + typed.entomb(&mut write) } /// Decodes a mutable binary slice into an immutable typed reference.