Magic Space
Yes, It's AI generated.
Derive macro for Solana program state structs that automatically calculates the space required for the struct.
Code mostly taken from @coral-xyz/anchor
project, modified to work without the anchor crate.
Source:
Installation
Add the following to your Cargo.toml
:
[]
= "^0.1.0"
Or cargo add:
Usage
use *;
If you have dynamic allocation, you can still use the max_len attribute as follows: #[max_len(0)]
and avoid worrying about the vector length, that way you can apply the following pattern:
License
Apache 2.0 LICENSE