mirror of
https://github.com/zap-proto/scala.git
synced 2026-10-30 15:03:46 +00:00
main
ZAP is a derivative work; this NOTICE credits the upstream project, its original authors, and license, alongside the unchanged LICENSE.
zap-proto/scala
Docs: ZAP Scala SDK · part of the ZAP Protocol
Scala 3 / Scala.js implementation of ZAP (Zero-copy App Proto). Idiomatic case classes, opaque types for zero-allocation reads.
Install
// build.sbt
libraryDependencies += "io.zap-proto" %% "zap" % "0.1.0"
Generate code
zap compile -o ./src/main/scala/gen --scala schema/*.zap
Encode / decode
import zap.proto.*
@main def run() =
val msg = gen.Message(id = 42, name = "hello")
val bytes = msg.toBytes
val decoded = gen.Message.fromBytes(bytes)
println(s"\${decoded.id} \${decoded.name}")
License
MIT
Languages
Scala
96%
ZAP
3.9%
HTML
0.1%