Rust

UCall for Rust

cargo add ucall 1.0.0-rc.1 · 60202332

Topics

Installation1The crate links the UCall library, which its build script compiles through CMake, so building needs CMake and a C++20 compiler.
QuickstartA server answers on one or more interfaces, and a client calls it; neither starts a thread.
Serving45Server::new takes the interfaces to answer on, and Server::withoptions also takes ServerOptions: the Backend, an optional CPUClass ceiling, a Log sink and a StatsD endpoint in Metrics.
Requests59A handler receives each Request by value.
Files and Streams6Handlers run on the polling thread, so a reply or a pull that finishes later runs on a worker: Request::detach hands the request over as a DetachedRequest, which reads and replies like a Request and alone has the three verbs below.
Batches8A batch endpoint gathers matching requests from every event loop into one queue and hands them to its handler in batches, which suits work that is cheaper per request in bulk, like GPU inference.
Calling24A Client submits calls without driving the network, and polls to drive them and collect what finished.
Noise Keys5Interfaces and calls can run over the Noise protocol instead of plain TCP, authenticating both sides by 32-byte Curve25519 static keys.
Errors4Every fallible call answers ucall::Result, whose Error carries the Status the library reported and a static message beside it, so nothing allocates on the failure path.
Threads and Polling2The crate starts no threads and needs no async runtime: every callback runs on a thread the application lent to a polling call.
DesignThe crate is a thin layer over UCall's native library, and every rule below follows from that.