Files
nim/tests/test_disconnect.nim
zeekay 68037f9ca4 Rebrand Cap'n Proto Nim port to ZAP
Rename the capnp/ module set to zap/ and the capnpc compiler to zapc;
rename all .capnp schemas and fixtures to .zap; update every import,
include guard (isInZap), generated-code emission, exception type
(ZapFormatError), and the macro-generated zapUnpackStructImpl/
zapPackStructImpl identifiers to the ZAP brand. Zero capnp/Cap'n Proto
references remain in source or build files; upstream MIT attribution
(Sandstorm, Michał Zieliński) is preserved.

Raise the nimble nim floor from the fictional 0.12.0 to the locked,
verified 0.15.2 (matches nimenv.cfg/build.sh; code carries fixes through
Nim 0.18). Rewrite TODO.md as honest, source-anchored known-limitations
(two-word intersegment pointers, nested/named-union codegen, RPC
interface inheritance) instead of a bare wishlist.
2026-06-19 23:42:02 -07:00

20 lines
552 B
Nim

import caprpc, zap, reactor
type MyCap = ref object of RootRef
proc call(self: MyCap, ifaceId: uint64, methodId: uint64, args: AnyPointer): Future[AnyPointer] {.async.} =
await waitForever()
asyncMain:
let (comm1, comm2) = newPipe(byte)
discard newTwoPartyServer(comm1, MyCap().asCapServer)
let client = newTwoPartyClient(comm2)
let mycap = await client.bootstrap().castAs(CapServer)
proc check() {.async.} =
discard await mycap.call(0.uint64, 0.uint64, ("hello").toAnyPointer)
let f = check()
comm1.close(JustClose)
await f