Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: near/borsh-rs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2462ed917c084055cda8c715ef5cc12ef28daf7e
Choose a base ref
..
head repository: near/borsh-rs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8bb5d6d93ac85094dd72c6362366c972ec63567e
Choose a head ref
Showing with 9 additions and 1 deletion.
  1. +1 −1 borsh/src/ser/helpers.rs
  2. +8 −0 borsh/src/ser/mod.rs
2 changes: 1 addition & 1 deletion borsh/src/ser/helpers.rs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ use crate::__private::maybestd::{
vec::Vec,
};

const DEFAULT_SERIALIZER_CAPACITY: usize = 1024;
pub(super) const DEFAULT_SERIALIZER_CAPACITY: usize = 1024;

/// Serialize an object into a vector of bytes.
pub fn to_vec<T>(value: &T) -> Result<Vec<u8>>
8 changes: 8 additions & 0 deletions borsh/src/ser/mod.rs
Original file line number Diff line number Diff line change
@@ -54,6 +54,14 @@ pub(crate) mod helpers;
pub trait BorshSerialize {
fn serialize<W: Write>(&self, writer: &mut W) -> Result<()>;

/// Serialize this instance into a vector of bytes.
#[deprecated = "use `borsh::to_vec(&object)` instead"]
fn try_to_vec(&self) -> Result<Vec<u8>> {
let mut result = Vec::with_capacity(helpers::DEFAULT_SERIALIZER_CAPACITY);
self.serialize(&mut result)?;
Ok(result)
}

#[inline]
#[doc(hidden)]
fn u8_slice(slice: &[Self]) -> Option<&[u8]>