Skip to main content

generate_from_directory

Function generate_from_directory 

Source
pub fn generate_from_directory(
    abi_dir: impl AsRef<Path>,
    output_dir: impl AsRef<Path>,
) -> AptosResult<()>
Expand description

Scans a directory for ABI files and generates code for all of them.

§Arguments

  • abi_dir - Directory containing ABI JSON files
  • output_dir - Directory where generated code will be written

§Errors

Returns an error if:

  • The directory cannot be read
  • No JSON files are found in the directory
  • Any ABI file cannot be read or parsed
  • Code generation fails for any module
  • The output directory cannot be created
  • Any output file cannot be written

§Example

build_helper::generate_from_directory("abi/", "src/generated/")?;