View Source Aptos.DataType.StructTag (Aptos v0.2.4)

Move StructTag.

Link to this section Summary

Functions

Parses an identifier such as "0x1::aptos_coin::AptosCoin".

Makes a new StructTag data.

Makes a new BCS data type specification by providing the BCS type layout of the function's type arguments.

Link to this section Types

@type t() :: %Aptos.DataType.StructTag{
  address: binary(),
  module: String.t(),
  name: String.t(),
  type_arguments: [BCS.DataType.t()]
}

Link to this section Functions

@spec from_string(binary()) :: :error | {:ok, t(), BCS.DataType.Struct.t()}

Parses an identifier such as "0x1::aptos_coin::AptosCoin".

A successful parsing gives {:ok, func_tag, bcs_type}.

For example:

StructTag.from_string("0x1::aptos_coin::AptosCoin") gives

{:ok,
  %StructTag{
    address: <<1>>,
    module: "aptos_coin",
    name: "AptosCoin",
    type_arguments: []
  },
  %T.Struct{
    layout: [
      address: %T.Address{},
      module: %T.Str{},
      name: %T.Str{},
      type_arguments: %T.List{inner: []}
    ]
  }}
@spec new(keyword()) :: t()

Makes a new StructTag data.

Makes a new BCS data type specification by providing the BCS type layout of the function's type arguments.