Closed billythedummy closed 10 months ago
Currently, the required method for BorshDeserialize has the following signature:
BorshDeserialize
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self>;
However, it can be changed to just:
fn deserialize_reader<R: Read>(reader: R) -> Result<Self>;
because Read has a blanket impl for mut references: https://docs.rs/borsh/latest/borsh/io/trait.Read.html#impl-Read-for-%26mut+R
Read
Similarly, BorshSerialize can be changed from
BorshSerialize
fn serialize<W: Write>(&self, writer: &mut W) -> Result<()>;
to
fn serialize<W: Write>(&self, writer: W) -> Result<()>;
because Write has a blanket impl for mut references: https://docs.rs/borsh/latest/borsh/io/trait.Write.html#impl-Write-for-%26mut+W
Write
This will be a breaking change
wrong repo, sorry. Moved to: https://github.com/near/borsh-rs/issues/270
Currently, the required method for
BorshDeserialize
has the following signature:However, it can be changed to just:
because
Read
has a blanket impl for mut references: https://docs.rs/borsh/latest/borsh/io/trait.Read.html#impl-Read-for-%26mut+RSimilarly,
BorshSerialize
can be changed fromto
because
Write
has a blanket impl for mut references: https://docs.rs/borsh/latest/borsh/io/trait.Write.html#impl-Write-for-%26mut+WThis will be a breaking change