2022-12-01 13:26:14 +04:00

39 lines
970 B
Plaintext

aqua StructCreation declares getObj, getObjRelay, getObjAssign
export getObj, getObjRelay, getObjAssign
import "@fluencelabs/aqua-lib/builtin.aqua"
data InnerObj:
arr: []string
num: u32
data SomeObj:
str: string
num: u64
inner: InnerObj
service OpNum("op"):
identity(n: u32) -> u32
service OpStr("op"):
identity(n: string) -> string
service OpArr("op"):
identity(arr: []string) -> []string
func getObj() -> SomeObj:
<- SomeObj(str = OpStr.identity("some str"), num = 5, inner = InnerObj(arr = ["a", "b", "c"], num = 6))
func getObjRelay() -> SomeObj:
on HOST_PEER_ID:
obj = SomeObj(str = "some str", num = 5, inner = InnerObj(arr = OpArr.identity(["a", "b", "c"]), num = 6))
Op.noop()
<- obj
func getObjAssign() -> SomeObj:
obj = SomeObj(str = "some str",
num = OpNum.identity(5),
inner = InnerObj(arr = ["a", "b", "c"], num = 6)
)
<- obj