ytsaurus_proto/lib.rs
1//! Generated protobuf bindings for the YTsaurus RPC proxy.
2//!
3//! The modules under [`nyt`] are generated by `prost-build` from the upstream
4//! `.proto` files in the `third_party/ytsaurus` submodule — not from a copy of
5//! them. The submodule records an exact upstream commit, so the definitions are
6//! pinned without a vendored copy that could drift.
7//!
8//! **The generated Rust is committed**, under `src/generated/`, and there is no
9//! build script. `cargo package` does not walk into a submodule, so generating
10//! at build time would produce a crate that builds from its own repository and
11//! fails from crates.io. Building this crate therefore needs neither the
12//! submodule nor `protoc`.
13//!
14//! Regenerate with `cargo xtask generate-protos`, after
15//! `./scripts/init-protos.sh` — which checks the submodule out shallow and
16//! sparse, so it costs about 23 MB rather than the whole monorepo. CI runs the
17//! same task and fails on a diff, so the committed code cannot drift from the
18//! pin.
19//!
20//! `prost` names a module after its protobuf package, and writes generated
21//! cross-package references as `super::`-relative paths, so the nesting below
22//! is not a matter of taste — it has to mirror the package names exactly or
23//! the generated code does not resolve.
24//!
25//! Everything under [`nyt`] is generated. The aliases beneath it are this
26//! crate's own, and are the names the rest of the workspace uses.
27//!
28//! ```
29//! use ytsaurus_proto::rpc::TRequestHeader;
30//!
31//! let header = TRequestHeader {
32//! service: "ApiService".to_owned(),
33//! method: "LookupRows".to_owned(),
34//! ..Default::default()
35//! };
36//! assert_eq!(header.service, "ApiService");
37//! ```
38
39#![allow(clippy::doc_overindented_list_items, clippy::enum_variant_names)]
40// The generated code carries upstream's own comments, and some of them contain
41// C++ types — `std::optional<std::vector<int>>`. rustdoc reads `<int>` as an
42// unclosed HTML tag. The comments are upstream's to write, not ours to edit,
43// and they are regenerated on every run.
44#![allow(rustdoc::invalid_html_tags)]
45
46/// Generated code, in modules mirroring the protobuf package names.
47pub mod nyt {
48 pub mod n_proto {
49 include!("generated/nyt.n_proto.rs");
50 }
51
52 pub mod n_bus {
53 pub mod n_proto {
54 include!("generated/nyt.n_bus.n_proto.rs");
55 }
56 }
57
58 pub mod n_rpc {
59 pub mod n_proto {
60 include!("generated/nyt.n_rpc.n_proto.rs");
61 }
62 }
63
64 pub mod n_tracing {
65 pub mod n_proto {
66 include!("generated/nyt.n_tracing.n_proto.rs");
67 }
68 }
69
70 pub mod ny_tree {
71 pub mod n_proto {
72 include!("generated/nyt.ny_tree.n_proto.rs");
73 }
74 }
75
76 pub mod n_yson {
77 pub mod n_proto {
78 include!("generated/nyt.n_yson.n_proto.rs");
79 }
80 }
81
82 pub mod n_api {
83 pub mod n_rpc_proxy {
84 pub mod n_proto {
85 include!("generated/nyt.n_api.n_rpc_proxy.n_proto.rs");
86 }
87 }
88 }
89
90 pub mod n_chaos_client {
91 pub mod n_proto {
92 include!("generated/nyt.n_chaos_client.n_proto.rs");
93 }
94 }
95
96 pub mod n_chunk_client {
97 pub mod n_proto {
98 include!("generated/nyt.n_chunk_client.n_proto.rs");
99 }
100 }
101
102 pub mod n_hive_client {
103 pub mod n_proto {
104 include!("generated/nyt.n_hive_client.n_proto.rs");
105 }
106 }
107
108 pub mod n_node_tracker_client {
109 pub mod n_proto {
110 include!("generated/nyt.n_node_tracker_client.n_proto.rs");
111 }
112 }
113
114 pub mod n_scheduler {
115 pub mod n_proto {
116 include!("generated/nyt.n_scheduler.n_proto.rs");
117 }
118 }
119
120 pub mod n_table_chunk_format {
121 pub mod n_proto {
122 include!("generated/nyt.n_table_chunk_format.n_proto.rs");
123 }
124 }
125
126 pub mod n_table_client {
127 pub mod n_proto {
128 include!("generated/nyt.n_table_client.n_proto.rs");
129 }
130 }
131
132 pub mod n_tablet_client {
133 pub mod n_proto {
134 include!("generated/nyt.n_tablet_client.n_proto.rs");
135 }
136 }
137}
138
139/// `NYT.NApi.NRpcProxy.NProto` — the API service surface.
140pub use nyt::n_api::n_rpc_proxy::n_proto as api;
141/// `NYT.NBus.NProto` — `THandshake`.
142pub use nyt::n_bus::n_proto as bus;
143/// `NYT.NProto` — `TGuid`, `TError`.
144pub use nyt::n_proto as misc;
145/// `NYT.NRpc.NProto` — the request and response headers.
146pub use nyt::n_rpc::n_proto as rpc;
147/// `NYT.NYTree.NProto` — the attribute dictionary errors carry.
148pub use nyt::ny_tree::n_proto as ytree;