another attempt to reduce allocations, don't know if helpers, certainly didn't eliminate all of them

This commit is contained in:
Christian Schwarz
2024-01-30 14:10:20 +00:00
parent f3e1ae6740
commit 1daeba6d87
8 changed files with 94 additions and 54 deletions

View File

@@ -161,6 +161,14 @@ pub trait BeSer {
be_coder().deserialize_from(r).map_err(|e| e.into())
}
/// Deserialize from a reader
fn des_from_custom<'s, R: bincode::BincodeRead<'s>>(r: R) -> Result<Self, DeserializeError>
where
Self: DeserializeOwned,
{
be_coder().deserialize_from_custom(r).map_err(|e| e.into())
}
/// Compute the serialized size of a data structure
///
/// Note: it may be faster to serialize to a buffer and then measure the