client_core/lib.rs
1//! Shared client-side primitives for Cinch CLI and desktop.
2//!
3//! Wire DTOs (`proto::cinch::v1::*`) are generated from the canonical
4//! `proto/cinch/v1/*.proto` files at build time via `prost-build`; see
5//! `build.rs` for the serde attribute injection that keeps wire bytes
6//! byte-equal to the Go relay's `encoding/json` `omitempty` output.
7//!
8//! The optional `specta` feature wires up `specta::Type` derives on wire
9//! DTOs that desktop exposes to the frontend. CLI builds without it.
10
11pub mod auth;
12pub mod auth_session;
13pub mod classify;
14pub mod config;
15pub mod credstore;
16pub mod crypto;
17pub mod http;
18pub mod key_exchange;
19pub mod machine;
20pub mod protocol;
21pub mod recovery;
22pub mod rest;
23pub mod store;
24pub mod sync;
25pub mod version;
26pub mod ws;
27
28/// Generated Rust message types from `proto/cinch/v1/*.proto`.
29///
30/// Wire-compatible with the Go relay's hand-written `protocol/*.go` DTOs:
31/// snake_case JSON tags, `omitempty` semantics preserved via field-level
32/// `skip_serializing_if` predicates injected in `build.rs`.
33#[allow(clippy::all)]
34pub mod proto {
35 pub mod cinch {
36 pub mod v1 {
37 include!(concat!(env!("OUT_DIR"), "/cinch.v1.rs"));
38 }
39 }
40}
41
42/// Helpers used by generated `#[serde(skip_serializing_if = "...")]`
43/// attributes to mirror Go's `encoding/json` `omitempty` semantics on
44/// scalar fields.
45pub mod ser {
46 pub fn is_zero_i32(v: &i32) -> bool {
47 *v == 0
48 }
49 pub fn is_zero_i64(v: &i64) -> bool {
50 *v == 0
51 }
52 pub fn is_false(v: &bool) -> bool {
53 !*v
54 }
55 pub fn is_empty_str(v: &str) -> bool {
56 v.is_empty()
57 }
58 pub fn is_empty_vec<T>(v: &[T]) -> bool {
59 v.is_empty()
60 }
61}