carbon_core

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.

Traits§

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

Functions§

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