github.com/nevalang/neva@v0.23.1-0.20240507185603-7696a9bb8dda/e2e/struct_builder_verbose/main/main.neva (about)

     1  // Here we learn how to build structures
     2  // by creating custom component with compiler directives.
     3  
     4  type User struct {
     5      age int
     6      name string
     7  }
     8  
     9  component {
    10      #extern(struct_builder)
    11      MyStructBuilder(age int, name string) (msg User)
    12  
    13      Main(start any) (stop any) {
    14          nodes { Println, builder MyStructBuilder }
    15  
    16          :start -> [
    17              ('John' -> builder:name),
    18              (32 -> builder:age)
    19          ]
    20          builder:msg -> println:data
    21          println:sig -> :stop
    22      }
    23  }