2 releases
new 0.1.1 | Oct 22, 2024 |
---|---|
0.1.0 | Oct 17, 2024 |
#15 in #carbon
275 downloads per month
Used in 12 crates
33KB
240 lines
Carbon Proc Macros
carbon-proc-macros
is a collection of procedural macros designed to simplify and enhance
Rust-based development for Solana programs using the Carbon framework.
This crate provides macros for generating
deserialization implementations, instruction decoders, and type conversions.
Overview
The macros in this crate are intended to streamline common patterns encountered
when working with Carbon, particularly around deserialization, instruction
decoding, and structuring custom types. By leveraging carbon-proc-macros
, you can reduce
the amount of manual coding and ensure consistent, performant handling of Solana-specific data
structures.
Key Features
CarbonDeserialize
: Automatically implement theCarbonDeserialize
trait for structs and enums, enabling Borsh-based deserialization with optional discriminators for type validation.Instruction Decoder Collection
: Create and manage complex instruction decoders for multiple Solana programs, simplifying how instructions are parsed and categorized.InstructionType
Derivation: DeriveInstructionType
enums that mirror existing enum structures, providing a simplified, data-free version of each variant.
Usage
To use any of the provided macros, simply import the desired macro into your Rust program and apply it to the relevant struct or enum.
Notes
- This crate relies on the
borsh
library for serialization and deserialization, so ensure the relevant dependencies are included in your project. - The macros provided are optimized for use within the Carbon framework.
Contribution
Contributions are welcome! If you have ideas for improving or expanding the functionality
of carbon_macros
, please consider submitting a pull request or opening an issue on the
project’s GitHub repository.
Dependencies
~71MB
~1.5M SLoC