Serialize a String in Borsh format: u32 LE byte-length + UTF-8 bytes. The length prefix is a 32-bit little-endian word (u32).
Modulesolana-haskell-sdk-1.3.0.0GHC2021
Network.Solana.Core.Borsh
This module provides helpers for Borsh serialization, which differs from Bincode in specific length encodings and enum tag widths. Both enforce strict 0/1 validation for Option tags and Bool encoding:
String lengths: Borsh uses 32-bit LE (u32), Bincode uses 64-bit LE (u64).
Vec counts: Borsh uses 32-bit LE (u32), Bincode uses 64-bit LE (u64).
Enum tags: Borsh uses 8-bit (u8), Bincode uses 32-bit LE (u32).
- 8 values
- Packagesolana-haskell-sdk-1.3.0.0
- Exports8
- LanguageGHC2021
- LicenceApache-2.0
- SourceBorsh.hs
Deserialize a String in Borsh format: u32 LE byte-length + UTF-8 bytes.
Fails if the length exceeds maxBound :: Int or if the bytes are not valid UTF-8.
Serialize a Maybe value in Borsh format: u8 tag (0 = Nothing, 1 = Just) + optional value.
Deserialize a Maybe value in Borsh format: u8 tag (0 = Nothing, 1 = Just) + optional value. Fails if the tag is not 0 or 1.
Serialize a list in Borsh format: u32 LE count + elements.
Deserialize a list in Borsh format: u32 LE count + elements.
Fails if the count exceeds maxBound :: Int.
Serialize a Bool in Borsh format: u8 (0 = False, 1 = True).
Deserialize a Bool in Borsh format: u8 (0 = False, 1 = True). Fails if the byte is not 0 or 1.