Module std::type_name
Functionality for converting Move types into values. Use with care!
- Struct TypeName
- Constants
- Function with_defining_ids
- Function with_original_ids
- Function defining_id
- Function original_id
- Function is_primitive
- Function as_string
- Function address_string
- Function module_string
- Function datatype_string
- Function into_string
- Function get
- Function get_with_original_ids
- Function borrow_string
- Function get_address
- Function get_module
use std::address;
use std::ascii;
use std::option;
use std::vector;
Struct TypeName
public struct TypeName has copy, drop, store
Fields
- name: std::ascii::String
-
String representation of the type. All types are represented
using their source syntax:
"u8", "u64", "bool", "address", "vector", and so on for primitive types.
Struct types are represented as fully qualified type names; e.g. 00000000000000000000000000000001::string::String or 0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>> Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or 32 depending on the Move platform)
Constants
ASCII Character code for the : (colon) symbol.
const ASCII_COLON: u8 = 58;
ASCII Character code for the < (less than) symbol.
const ASCII_LESS_THAN: u8 = 60;
ASCII Character code for the v (lowercase v) symbol.
const ASCII_V: u8 = 118;
ASCII Character code for the e (lowercase e) symbol.
const ASCII_E: u8 = 101;
ASCII Character code for the c (lowercase c) symbol.
const ASCII_C: u8 = 99;
ASCII Character code for the t (lowercase t) symbol.
const ASCII_T: u8 = 116;
ASCII Character code for the o (lowercase o) symbol.
const ASCII_O: u8 = 111;
ASCII Character code for the r (lowercase r) symbol.
const ASCII_R: u8 = 114;
The type is not from a package/module. It is a primitive type.
const ENonModuleType: u64 = 0;
Function with_defining_ids
Return a value representation of the type T. Package IDs that appear in fully qualified type names in the output from this function are defining IDs (the ID of the package in storage that first introduced the type).
public fun with_defining_ids<T>(): std::type_name::TypeName
Function with_original_ids
Return a value representation of the type T. Package IDs that appear in fully qualified type names in the output from this function are original IDs (the ID of the first version of the package, even if the type in question was introduced in a later upgrade).
public fun with_original_ids<T>(): std::type_name::TypeName
Function defining_id
Like with_defining_ids, this accesses the package ID that original defined the type T.
public fun defining_id<T>(): address