Module 0x1::type_name
Functionality for converting Move types into values. Use with care!
- Struct
TypeName
- Constants
- Function
get
- Function
get_with_original_ids
- Function
is_primitive
- Function
borrow_string
- Function
get_address
- Function
get_module
- Function
into_string
use 0x1::ascii;
Struct TypeName
struct TypeName has copy, drop, store
Fields
Constants
ASCII Character code for the c (lowercase c) symbol.
const ASCII_C: u8 = 99;
ASCII Character code for the : (colon) symbol.
const ASCII_COLON: u8 = 58;
ASCII Character code for the e (lowercase e) symbol.
const ASCII_E: u8 = 101;
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;
ASCII Character code for the t (lowercase t) symbol.
const ASCII_T: u8 = 116;
ASCII Character code for the v (lowercase v) symbol.
const ASCII_V: u8 = 118;
The type is not from a package/module. It is a primitive type.
const ENonModuleType: u64 = 0;
Function get
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 get<T>(): type_name::TypeName
Implementation
Function get_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 get_with_original_ids<T>(): type_name::TypeName
Implementation
Function is_primitive
Returns true iff the TypeName represents a primitive type, i.e. one of u8, u16, u32, u64, u128, u256, bool, address, vector.
public fun is_primitive(self: &type_name::TypeName): bool
Implementation
Function borrow_string
Get the String representation of self
public fun borrow_string(self: &type_name::TypeName): &ascii::String
Implementation
Function get_address
Get Address string (Base16 encoded), first part of the TypeName. Aborts if given a primitive type.
public fun get_address(self: &type_name::TypeName): ascii::String
Implementation
Function get_module
Get name of the module. Aborts if given a primitive type.
public fun get_module(self: &type_name::TypeName): ascii::String
Implementation
Function into_string
Convert self into its inner String
public fun into_string(self: type_name::TypeName): ascii::String