<aside> 🚧
Note that some of this API is not yet implemented. This document act as a “pretend documentation” of the macro API to collect early feedback before implementing it.
</aside>
#[codama(...)].DefaultPlugin should only export IDL items that are explicitly whitelisted using Codama derives — e.g. CodamaAccount.The Codama struct provides an entry-point to the Codama Macro API. Simply use the load method to fetch all files from the provided crate directory and create a Codama instance. You can then use methods such as get_idl to get the RootNode of the Codama IDL or get_json_idl if you want it in JSON format.
let codama = Codama::load(&Path::new("path/to/my/crate"))?;
let idl: RootNode = codama.get_idl()?;
let json_idl: String = codama.get_json_idl()?;
API
Any data structure defined in Rust as the potential to be exported as DefinedTypeNodes as long as they use the CodamaType derive and all types in fields/variants have been properly identified.
#[derive(CodamaType)]
struct Person {
name: String,
age: u16,
}