vgi-rpc-macros
Proc-macros for vgi-rpc. Re-exported
from vgi-rpc (default-on macros feature) so you only depend on
vgi-rpc directly.
What you get
#[vgi_rpc::service]— attribute on animplblock. Generates aSelf::register_with(server, instance)that wires every annotated method into anRpcServer.#[unary],#[producer],#[exchange]— method markers consumed by#[service].#[param]— per-parameter metadata (name,doc,default,rename).#[derive(VgiArrow)]— auto-implVgiArrowfor plain structs; the wire format mirrors the PythonArrowSerializableDataclasslayout (Struct<fields>with each field's Arrow data type).#[derive(StreamState)]— auto-implStreamStateCodec(bincode) on a state type. Container#[stream_state(rebuild = "fn_path")]re-derives non-serializable fields after decode (e.g. dynamic schemas).
Quick start
use ;
use Arc;
use ;
use ;
;
let mut server = builder.protocol_name.build;
register_with;
Method-attribute reference
// sync; result schema from return type
async // single-column "value" output
// custom output schema fn
// with typed header
// dynamic schema
// method param `n`, wire name `wireName`
header_fn / schema_fn paths must point to free functions taking
&vgi_rpc::server::Request and returning Result<HeaderType> /
Result<SchemaRef> respectively.
Built-in VgiArrow types
| Rust | Arrow DataType |
|---|---|
String |
Utf8 |
i64, i32 |
Int64 / Int32 |
f64, f32 |
Float64 / Float32 |
bool |
Boolean |
vgi_rpc::Bytes(Vec<u8>) |
Binary |
Vec<T> |
List<T> |
Vec<Vec<T>> |
List<List<T>> |
Vec<(String, V)> |
Map<Utf8, V> |
Option<T> |
inner T with nullable=true |
#[derive(VgiArrow)] struct |
Struct<fields> |
Vec<u8> is treated as List<UInt8>, not Binary. Use the
vgi_rpc::Bytes newtype when you want Arrow Binary.
Compile-fail behavior
The macro emits typed compile_error! for misuse:
#[producer]withoutstate =#[unary]returning a non-Result<T>type#[derive(VgiArrow)]on a struct with a non-VgiArrowfieldheader = Twithoutheader_fn = path(or vice versa)dynamicwithoutschema_fn = pathdynamicon#[exchange]
Fixtures live in vgi-rpc/tests/macro_compile_fail/.