Skip to content

Commit

Permalink
allow any writer, not only mutable references to writers
Browse files Browse the repository at this point in the history
  • Loading branch information
antonilol committed Aug 20, 2024
1 parent 42725fc commit 4536a2f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion heed-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub trait BytesEncode<'a> {
/// The default implementation forwards to [`bytes_encode`][BytesEncode::bytes_encode].
fn bytes_encode_into_writer<W: io::Write>(
item: &'a Self::EItem,
writer: &mut W,
mut writer: W,
) -> Result<(), BoxedError> {
let bytes = Self::bytes_encode(item)?;

Expand Down
2 changes: 1 addition & 1 deletion heed-types/src/serde_bincode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ where

fn bytes_encode_into_writer<W: std::io::Write>(
item: &'a Self::EItem,
writer: &mut W,
writer: W,
) -> Result<(), BoxedError> {
bincode::serialize_into(writer, item)?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion heed-types/src/serde_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ where

fn bytes_encode_into_writer<W: std::io::Write>(
item: &'a Self::EItem,
writer: &mut W,
writer: W,
) -> Result<(), BoxedError> {
serde_json::to_writer(writer, item)?;
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions heed-types/src/serde_rmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ where

fn bytes_encode_into_writer<W: std::io::Write>(
item: &'a Self::EItem,
writer: &mut W,
mut writer: W,
) -> Result<(), BoxedError> {
rmp_serde::encode::write(writer, item)?;
rmp_serde::encode::write(&mut writer, item)?;
Ok(())
}
}
Expand Down

0 comments on commit 4536a2f

Please sign in to comment.