Explorer

core.value-to-event-content

description
Read a value of the evaluator (core.value) as core.event-content. none if the shape differs (generated by scripts/generate_value_decoders.ts)
type
Fn(value: @core.value) -> Union{#none, #some(@core.event-content)}
expression
fn(value$0) =>
  match $0 {
    #variant(variant$1) =>
      match $1.tag {
        "create_account" =>
          match @core.value-decoded(
              T: Record{account_name: String},
              decoded: match $1.payload {
                #record(fields$3) =>
                  match @core.value-record-field(fields: $3, key: "account_name", index: 0) {
                    #some(field$4) =>
                      match @core.value-decoded(
                          T: String,
                          decoded: match $4 {
                            #string(v$6) =>
                              #some($6),
                            _ =>
                              #none
                          }
                        ) {
                        #some(account_name$5) =>
                          #some({account_name: $5}),
                        _ =>
                          #none
                      },
                    _ =>
                      #none
                  },
                _ =>
                  #none
              }
            ) {
            #some(payload$2) =>
              #some(#create_account<@core.event-content>($2)),
            _ =>
              #none
          },
        "project_commit" =>
          match @core.value-to-project-snapshot(value: $1.payload) {
            #some(payload$7) =>
              #some(#project_commit<@core.event-content>($7)),
            _ =>
              #none
          },
        _ =>
          #none
      },
    _ =>
      #none
  }
visibility
public
core.value-to-event-content (project definy, branch auto-release, snapshot oiQgPqhJm-TbM4kexXeRHBaJB_tS7gwBSewII64P-44)
id: tiLE7UgtppYMjGX88VyUXNasG8g_YyfvMqw8Sf_FwBU
content hash: M55eptgV2dGDmhfZAcyx7ZSuAOsDR91aVbVPtfEMMro