Files
herolib/lib/data/encoderhero
Mahmoud-Emad b15c4cd15a refactor: Change hero action syntax to verb.noun
- Change action name format from `obj.verb` to `verb.obj`
- Update decoder to look for `define.obj` or `configure.obj`
- Modify encoder export to use the new `define.obj` prefix
- Update all test constants and scripts to the new syntax
- Make Remark struct public for test visibility
2025-08-05 19:02:26 +03:00
..
2024-12-25 09:23:31 +01:00
...
2025-02-06 21:09:20 +03:00
2024-12-25 09:23:31 +01:00
2024-12-25 09:23:31 +01:00

hero Encoder


#!/usr/bin/env -S v -n -w -gc none  -cc tcc -d use_openssl -enable-globals run

import freeflowuniverse.herolib.data.encoderhero
import freeflowuniverse.herolib.core.base
import time

struct Person {
mut:
	name     string
	age      int = 20
	birthday time.Time
}

mut person := Person{
    name: 'Bob'
    birthday: time.now()
}
heroscript := encoderhero.encode[Person](person)!

println(heroscript)

person2 := encoderhero.decode[Person](heroscript)!

println(person2)