Files
zeekay c7694a7285 zip in Rust serves on hyper, and an op can stream
An op is an async fn. It may take &zip::Cx (request headers; the
answer's status, headers and trailers) and a zip::Body read as it
arrives, and may answer zip::Sse or zip::Body, each chunk written as
the op yields it. A client that leaves drops the op's stream.

The blocking std::net door is gone: HTTP/1.1 keep-alive and h2c on
one port (hyper_util auto), graceful shutdown bounded by a grace.
The ZAP door runs on tokio and streams with zap-proto/http's head,
data and end frames.

Wire names are serde's: the derive reads rename, rename_all, skip
and with, and the hand-rolled JSON is deleted. The info manifest
comes out byte for byte as before.

No zapgen emits Rust, so the crate never built; the frame codec is
written in zap.rs and pinned to frames Go wrote. The length prefix
is big-endian, as zap-proto/http's transport writes it.

examples/stream is a JSON op, an SSE op with a trailer and a byte
relay, tested over raw HTTP/1.1, h2c and ZAP sockets.

Claude-Session: https://claude.ai/code/session_01SCPMGSQsLNF2YtHFL4bwyp
2026-10-08 12:56:07 -07:00

27 lines
1.1 KiB
Rust

// SPDX-License-Identifier: BSD-3-Clause-Eco
// Copyright (C) 2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//! The documents this service publishes, if they have been projected yet.
//!
//! They are checked in, so a clone builds with them in hand. But they are made
//! FROM this crate — zipc reads the manifest the compiled binary prints — so
//! the first build of a new service necessarily happens before they exist. This
//! says so instead of failing: no documents yet, and `make gen` makes them.
use std::path::PathBuf;
fn main() {
println!("cargo:rerun-if-changed=gen");
let out = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR"));
let mut body = String::new();
for (name, file) in [("OPENAPI", "gen/openapi.json"), ("MCP", "gen/mcp.json")] {
let text = std::fs::read_to_string(file).unwrap_or_default();
body.push_str(&format!(
"pub const {name}: &str = {:?};\n",
if text.is_empty() { "" } else { text.as_str() }
));
}
std::fs::write(out.join("documents.rs"), body).expect("write documents.rs");
}