Borsh in Rust
borsh-rs is Rust implementation of the Borsh binary serialization format.
Borsh stands for Binary Object Representation Serializer for Hashing. It is meant to be used in security-critical projects as it prioritizes consistency, safety, speed, and comes with a strict specification.
Example
use ;
Features
Opting out from Serde allows borsh to have some features that currently are not available for serde-compatible serializers.
Currently we support two features: borsh_init
and borsh_skip
(the former one not available in Serde).
borsh_init
allows to automatically run an initialization function right after deserialization. This adds a lot of convenience for objects that are architectured to be used as strictly immutable. Usage example:
borsh_skip
allows to skip serializing/deserializing fields, assuming they implement Default
trait, similary to #[serde(skip)]
.
Releasing
After you merged your change into the master branch and bumped the versions of all three crates it is time to officially release the new version.
Make sure borsh
, borsh-derive
, borsh-derive-internal
, and borsh-schema-derive-internal
all have the new crate versions. Then run the publish.sh
script:
Make sure you are on the master branch, then tag the code and push the tag:
License
This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0). See LICENSE-MIT and LICENSE-APACHE for details.