0.2.0 • Published 1 year ago

rust_codegen v0.2.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

This Rust library provides a WebAssembly interface for generating mapping code, YAML files, and schema files from given contract configurations for generation of subgraph code. This library contains a module named codegen which is responsible for implementing the functionality. The exposed functions are wrapped using the wasm_bindgen attribute to be callable from JavaScript.

Functions

generate_mapping(val: JsValue) -> Result<String, String>

This function takes a JavaScript value representing a contract configuration and generates the mapping code. If successful, it returns the generated mapping code as a string. If there's an error, it returns a string describing the error.

Parameters:

  • val: (JsValue) A JavaScript value containing the contract configuration.

Returns:

  • Result: A result containing the generated mapping code as a string or an error message as a string.

generate_yaml(val: JsValue) -> Result<String, String>

This function takes a JavaScript value representing an array of contract configurations and generates the YAML files. If successful, it returns the generated YAML files as a string. If there's an error, it returns a string describing the error.

Parameters:

  • val: (JsValue) A JavaScript value containing the array of contract configurations.

Returns:

  • Result: A result containing the generated YAML files as a string or an error message as a string.

generate_schema(val: JsValue) -> Result<String, String>

This function takes a JavaScript value representing an array of contract configurations and generates the schema files. If successful, it returns the generated schema files as a string. If there's an error, it returns a string describing the error.

Parameters:

  • val: (JsValue) A JavaScript value containing the array of contract configurations.

Returns:

  • Result: A result containing the generated schema files as a string or an error message as a string.

generate_helpers() -> String

This function generates some of the helper functions that we use in the generated code

0.2.0

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago