Fields in list data, names of source nodes, and everything in between use human readable text to represent their identity. When working with the Data API,
ink_ident is used to represent these names. Reasons for using
ink_ident instead of raw strings is largely for performance and program complexity.
ink_ident is a 64 bit integer, with a few APIs to handle converting to and from text.
Automatic Identifier Generation
A project's settings file has options for generating code that maps between all identifiers used in quill and constant language specific identifiers.
For example, take the following configuration in a project's quill.toml file:
[output] identifiers_c = "idents.h" identifiers_cs = "I.cs" identifiers_rust = "idents.rs" identifiers_java = "I.java"
Will cause Quill to create something that might look like this:
Which would allow you to use these identifier constants instead of calling
Identifiers generated by Quill have their original string value saved in gui.bin. Upon loading they are added to the reverse lookup cache and accessible from
Convert a string to an identifier:
ink_ident ink_ident_from_str(const char*); ink_ident ink_ident_from_strn(const char* str, size_t len);
Convert a string to an identifier without adding it to the reverse lookup cache:
ink_ident ink_ident_from_strn_no_reverse(const char* str, size_t len);
Adds a string to the reverse lookup cache:
void ink_ident_add_reverse(const char* str, size_t len);
Retrieve the string that was used to create the ident, returns null if the ident doesn't exist in the reverse lookup cache:
const char* ink_ident_as_char(ink_ident);