pub fn generate_from_abis(
abi_paths: &[impl AsRef<Path>],
output_dir: impl AsRef<Path>,
) -> AptosResult<()>Expand description
Generates Rust code from multiple ABI files.
Also generates a mod.rs file that re-exports all generated modules.
§Arguments
abi_paths- Paths to ABI JSON filesoutput_dir- Directory where generated code will be written
§Errors
Returns an error if:
- Any ABI file cannot be read
- Any ABI JSON cannot be parsed
- Code generation fails for any module
- The output directory cannot be created
- Any output file cannot be written
- The
mod.rsfile cannot be written
§Example
ⓘ
build_helper::generate_from_abis(&[
"abi/coin.json",
"abi/token.json",
], "src/generated/")?;