use 0x1::option;
use 0x1::string;
use 0x2::bcs;
use 0x2::type_info;
A type which can represent a value of any type. This allows for representation of 'unknown' future values. For example, to define a resource such that it can be later be extended without breaking changes one can do
struct Resource {
field: Type,
...
extension: Option<Any>
}
struct Any has drop, store
const ErrorInvalidBytes: u64 = 2;
The type provided for unpack
is not the same as was given for pack
.
const ErrorTypeMismatch: u64 = 1;
Pack a value into the Any
representation. Because Any can be stored and dropped, this is
also required from T
.
Unpack a value from the Any
representation. This aborts if the value has not the expected type T
.
Returns the type name of this Any
public fun type_name(x: &any::Any): &string::String