The Move Standard Library provides functionality for native types and operations. It is a standard collection of modules which do not interact with the storage, but provide basic tools for working and manipulating the data. It is the only dependency of the Moved Network Framework, and is imported together with it.
In this book we go into detail about most of the modules in the Standard Library, however, it is also helpful to give an overview of the features, so that you can get a sense of what is available and which module implements it.
Module | Description | Chapter |
---|---|---|
std::string | Provides basic string operations | String |
std::ascii | Provides basic ASCII operations | String |
std::option | Implements an Option<T> | Option |
std::vector | Native operations on the vector type | Vector |
std::bcs | Contains the bcs::to_bytes() function | BCS |
std::address | Contains a single address::length function | Address |
std::type_name | Allows runtime type reflection | Type Reflection |
std::hash | Hashing functions: sha2_256 and sha3_256 | Cryptography and Hashing |
std::debug | Contains debugging functions, which are available in only in test mode | Debugging |
std::bit_vector | Provides operations on bit vectors | - |
std::fixed_point32 | Provides the FixedPoint32 type | - |
Standard Library exports one named address - std = 0x1
.
[addresses]
std = "0x1"
Some of the modules are imported implicitly, and are available in the module without explicit use
import. For Standard Library, these modules and types are:
The Move Standard Library can be imported to the package directly. However, std
alone is not enough to build a meaningful application, as it does not provide any storage capabilities, and can't interact with the on-chain state.
MoveStdlib = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "framework/mainnet" }