use 0x1::option;
use 0x1::string;
use 0x2::bcs;
use 0x2::type_info;
The same as any::Any
but with the copy ability.
struct Any has copy, 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, dropped, and copied this is
also required from T
.
public fun pack<T: copy, drop, store>(x: T): copyable_any::Any
Unpack a value from the Any
representation. This aborts if the value has not the expected type T
.
public fun unpack<T>(x: copyable_any::Any): T
Returns the type name of this Any
public fun type_name(x: ©able_any::Any): &string::String