Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignalina authored Oct 24, 2022
1 parent c5576b2 commit ece5765
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,27 @@ The example main.go should envision how your GO application utilize Alloy.

```golang
func main() {
mem := memory.NewGoAllocator()
values := [][]int32{
{1, 2, 3, -4},
{2, 3, 4, 5},
{3, 4, 5, 6},
}

builders, arrays := buildAndAppend(mem, values)

....

goBridge := api.GoBridge{GoAllocator: mem}
ret, err := goBridge.FromChunks(arrays)

api.Info(fmt.Sprintf("Rust counted %v arrays sent through rust", ret))
}
mem := memory.NewGoAllocator()

var b api.Bridge
b = rust.Bridge{api.CommonParameter{mem}}

values := [][]int32{
{1, 2, 3, -4},
{2, 3, 4, 5},
{3, 4, 5, 6},
}

builders, arrays := buildAndAppend(mem, values)

ret, err := b.FromChunks(arrays)

if nil != err {
fmt.Println(err)
} else {
rust.Info(fmt.Sprintf("Rust counted %v arrays sent through ffi", ret))
}
}
```

Output, where default dummy Rust backend echoes out the sent data. It will be up to the Rust guys to implent code to process the data to their hearts content !!
Expand Down

0 comments on commit ece5765

Please sign in to comment.