Crate borsh

source ·
Expand description

Crate features

Ecosystem features

  • std - When enabled, this will cause borsh to use the standard library. Currently, disabling this feature will result in building the crate in no_std environment.

    Borsh has nostd_io module when compiled with std disabled. It contains a few items, counterparts of std::io items, which are used in BorshSerialize and BorshDeserialize traits’ definitions in absence of std. Most prominent of them are borsh::nostd_io::Read and borsh::nostd_io::Write traits.

Default features

  • std - enabled by default.

Other features

Config aliases

Re-exports

Modules

  • Module is available if borsh is built with features = ["derive", "schema"].

Functions

  • Serialize an object into a vector of bytes.
  • Serializes an object directly into a Writer.
  • Deserialize this instance from a slice of bytes, but assume that at the beginning we have bytes describing the schema of the type. We deserialize this schema and verify that it is correct.
  • Serialize object into a vector of bytes and prefix with the schema serialized as vector of bytes in Borsh format.

Derive Macros

  • Derive macro available if borsh is built with features = ["derive"].
  • Derive macro available if borsh is built with features = ["derive", "schema"].
  • Derive macro available if borsh is built with features = ["derive"].