Skip to content

Commit

Permalink
Take writer by value
Browse files Browse the repository at this point in the history
  • Loading branch information
HadrienG2 committed Sep 26, 2019
1 parent 9d4f8a7 commit 12bf34f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ pub mod abomonated;
/// ```
///
#[inline(always)]
pub unsafe fn encode<T: Abomonation, W: Write>(typed: &T, write: &mut W) -> IOResult<()> {
pub unsafe fn encode<T: Abomonation, W: Write>(typed: &T, mut write: W) -> IOResult<()> {
let slice = std::slice::from_raw_parts(mem::transmute(typed), mem::size_of::<T>());
write.write_all(slice)?;
typed.entomb(write)
typed.entomb(&mut write)
}

/// Decodes a mutable binary slice into an immutable typed reference.
Expand Down

0 comments on commit 12bf34f

Please sign in to comment.