Skip to content

A C++20 implementation of the Borsh binary serializer

Notifications You must be signed in to change notification settings

etodanik/borsh-cpp20

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Borsh for C++20

borsh-cpp20 is an implementation of the borsh serialization specification for C++20.

Motivation

Basically, at the time of writing there was no feature complete borsh serializer / deserializer implementation available for C++ at all, so this code is an attempt to fill that gap.

Current state

The library isn't ready for production, and the code is published just for building in public. Please don't use it until it is.

Below is a list of types specified in the Rust specification, with the ones implemented checked. Every checked type is tested to be binary compatible with the borsh specification:

  • Integers (int8_t, int16_t, int32_t, int64_t, __int128, uint8_t, uint16_t, uint32_t, uint64_t, unsigned __int128, bool)
  • Bool
  • Floats (float, double, long double)
  • Unit (std::monostate), a noop in Borsh
  • Fixed sized arrays (C-style array[], std::array)
  • Dynamic sized array (std::vector)
  • Struct
  • Named fields
  • Enum
  • HashMap (std::unordered_map)
  • HashSet (std::unordered_set)
  • Option (std::optional)
  • String (std::string)

The following types don't have a direct equivalent in C++:

  • Unnamed fields

About

A C++20 implementation of the Borsh binary serializer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published