1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! **kaivrpc** — RPC over [kaiv](https://kaiv.io/) documents.
//!
//! A request is a document; a response is a document. Both sides
//! are ordinary kaiv, so a request can be saved, diffed, and
//! replayed with `curl --data-binary @req.kaiv`, and a response
//! can be validated against its schema, grepped, or consumed
//! line by line as it streams.
//!
//! ```text
//! .!kaiv → .!daiv
//! method=Post.MultiGet .!schema:kaivrpc/response-head
//! /params::ws=AGORA .!schema:<method's data schema>
//! /params/@ids;=t3_9fq2k .!schema:kaivrpc/response-tail
//! !str'::status=ok
//! !str'/data/@posts/0::id=t3_9fq2k
//! …
//! !null'::error=
//! !int'::n=1
//! ```
//!
//! # The envelope is three composed schemas
//!
//! A response declares a **head** (`::status`, the verdict before
//! any data flows), the method's own **data schema** (fields under
//! `/data`), and a **tail** (`::error?` and the required `::n`).
//! Composition order is composed field order, so the ordered scan
//! enforces the layout — and because the tail is schema-REQUIRED
//! and last, a truncated response fails validation on the client
//! with no protocol machinery at all. The envelope schemas live in
//! this crate's [`schemas`] module; publish them (or your own
//! namespaced copies — see [`Envelope::with_schemas`]) so clients
//! can resolve them.
//!
//! # Streaming is the point
//!
//! Every canonical line is a self-contained `(type, namepath,
//! value)` fact, so a server can flush as it goes and a client can
//! act on each element the moment its run ends.
//! [`Response::stream_chunks`] emits one chunk per element run —
//! the measured compression-friendly cadence (flushing per LINE
//! forfeits compression; per element run costs ~30% against a
//! buffered body while keeping a shared compression context for
//! the whole response).
//!
//! # What this crate is not
//!
//! Transport-agnostic by construction: no HTTP framework, no
//! async runtime. You get `String`s and `Vec<String>`s and wire
//! them into whatever server you have. Dispatch, authentication,
//! and authorization stay yours.
pub use ;
pub use ;
pub use ;
/// Per-field wire-type overrides — re-exported from kaiv, since
/// every non-trivial response needs them: serde sees only the Rust
/// type, but a union's discriminant and `!text` are NOMINAL on the
/// wire.
pub use ;