Module utils

Module utils 

Source
Expand description

Utility functions for the contract macro implementation.

Functionsยง

extract_attributes ๐Ÿ”’
Extracts #[slot(N)], #[base_slot(N)] attributes from a fieldโ€™s attributes.
extract_mapping_types ๐Ÿ”’
Extracts the type parameters from Mapping<K, V>.
extract_storable_array_sizes ๐Ÿ”’
Extracts array sizes from the #[storable_arrays(...)] attribute.
parse_slot_value ๐Ÿ”’
Parses a slot value from a literal.
to_camel_case ๐Ÿ”’
Converts a string from snake_case to camelCase.
to_snake_case ๐Ÿ”’
Converts a string from CamelCase or snake_case to snake_case. Preserves SCREAMING_SNAKE_CASE, as those are assumed to be constant/immutable names.

Type Aliasesยง

ExtractedAttributes ๐Ÿ”’
Return type for extract_attributes: (slot, base_slot)