Module deserialize

Module deserialize 

Source
Expand description

Provides traits and utility functions for deserialization and account arrangement within the carbon-core framework.

This module includes the CarbonDeserialize trait for custom deserialization of data types, the extract_discriminator function for splitting data slices by a discriminator length, and the ArrangeAccounts trait for defining of Solana account metadata.

§Overview

  • CarbonDeserialize: A trait for custom deserialization of data structures from byte slices.
  • extract_discriminator: A function that separates a discriminator from the rest of a byte slice, used for parsing data with prefixed discriminators.
  • ArrangeAccounts: A trait that allows for defining a specific arrangement of accounts, suitable for handling Solana account metadata in a customized way.

§Notes

  • The CarbonDeserialize trait requires implementers to also implement borsh::BorshDeserialize.
  • Ensure that extract_discriminator is used with data slices large enough to avoid runtime errors.
  • Implement ArrangeAccounts when you need to access account metadata for Solana instructions.

Structs§

PrefixString
A wrapper type for strings that are prefixed with their length.
U64PrefixString
A wrapper type for strings that are prefixed with their length.

Traits§

ArrangeAccounts
A trait for defining a custom arrangement of Solana account metadata.
CarbonDeserialize
A trait for custom deserialization of types from byte slices.

Functions§

extract_discriminator
Extracts a discriminator from the beginning of a byte slice and returns the discriminator and remaining data.