Skip to content

Latest commit

 

History

History
93 lines (43 loc) · 2.58 KB

copyable_any.md

File metadata and controls

93 lines (43 loc) · 2.58 KB

Module 0x2::copyable_any

Source from https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-stdlib/sources/copyable_any.move

Struct Any

The same as any::Any but with the copy ability.

struct Any has copy, drop, store

Constants

const ErrorInvalidBytes: u64 = 2;

The type provided for unpack is not the same as was given for pack.

const ErrorTypeMismatch: u64 = 1;

Function pack

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

Function unpack

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

Function type_name

Returns the type name of this Any