Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Parser (Cainome)
A run-time library to generate an intermediate representation of Cairo ABI.
The parser is in charge to parse the ABI entries and convert then into tokens. Those tokens represent the ABI in a comprehensive manner to then be used for lowering into different languages.
Tokens
The Cairo ABI is represented by a set of 6 tokens:
- basic (
CoreBasic): corelib types, which are every types starting withcore::that can fit into a single felt and the unit (()) type. This excludesArray, which is processed on it's own token. - array (
Array):ArrayandSpanare included in this token.Spanis normally a struct, but considered asArrayby the parser. - tuple (
Tuple): tuple of any length >= 1. - composite (
Composite): any type defined in the ABI as a struct or an enum. All composite type name is automatically converted intoPascalCase. - function (
Function): views and externals functions. - generic argument (
GenericArg): a generic argument, resolved with it's letter (A,B...).
Genericity
As Cairo is a language that support generic arguments, the ABI does not include any information about the generic argument typing. Types are totally flatten in the ABI.
Will exist in the ABI as many time as a function uses GenericOne with a different A value.
For instance, if one function output is:
fn my_func(self: @ContractState) -> GenericOne<felt252>;
The ABI will contain:
,
And here as you can see, we've lost the information about the genericity.
To deal with that, Cainome has (for now) a very simple algorithm:
- It gathers all the structs and enums with the exact same type path
contracts::abicov::structs::GenericOnein this example. - It resolves the genericity of
structsandenums, meaning that if the generic argument iscore::felt252, all the tokens found in the members (recursively) will have theCoreBasictoken replaced byGenericArgand the corresponding letter. In the example above, the memberawill becomeGenericArg("A"). - Finally, the tokens are ordered in a map with
structs,enumsandfunctions.
Events
Events at top level are enums. And those enums, have some variants that are struct and others are enums. The parser clearly labels any composite that is an event, which allow further processing dedicated for the events.
Auto deserialization from EmittedEvent coming soon.