Module diem_sdk::move_types::identifier
Expand description
An identifier is the name of an entity (module, resource, function, etc) in Move.
A valid identifier consists of an ASCII string which satisfies any of the conditions:
- The first character is a letter and the remaining characters are letters, digits or underscores.
- The first character is an underscore, and there is at least one further letter, digit or underscore.
The spec for allowed identifiers is similar to Rust’s spec (as of version 1.38).
Allowed identifiers are currently restricted to ASCII due to unresolved issues with Unicode normalization. See Rust issue #55467 and the associated RFC for some discussion. Unicode identifiers may eventually be supported once these issues are worked out.
This module only determines allowed identifiers at the bytecode level. Move source code will
likely be more restrictive than even this, with a “raw identifier” escape hatch similar to
Rust’s r#
identifiers.
Among other things, identifiers are used to:
- specify keys for lookups in storage
- do cross-module lookups while executing transactions
Macros
ident_str!
is a compile-time validated macro that constructs a&'static IdentStr
from a const&'static str
.
Structs
- A borrowed identifier.
- An owned identifier.
Functions
- Describes what identifiers are allowed.
- Return true if this character can appear in a Move identifier.