Skip to main content

sova_grpc/
lib.rs

1//! Connect-JSON unary RPC for Sova — client first, optional server.
2//!
3//! ```ignore
4//! use sova_grpc::{FakeGrpc, Grpc, GrpcExt};
5//! use serde::{Deserialize, Serialize};
6//!
7//! #[derive(Serialize)]
8//! struct HelloIn { name: String }
9//! #[derive(Deserialize)]
10//! struct HelloOut { message: String }
11//!
12//! let fake = FakeGrpc::new().stub_json("hello.Greeter/SayHello", serde_json::json!({
13//!     "message": "hi"
14//! }));
15//! app.install(Grpc::fake(fake));
16//!
17//! let out: HelloOut = req.grpc().call("hello.Greeter/SayHello", &HelloIn { name: "a".into() }).await?;
18//! ```
19
20mod bound;
21mod client;
22mod error;
23mod error_envelope;
24mod fake;
25mod plugin;
26mod router;
27mod server;
28mod trace;
29mod transport;
30
31pub use bound::{GrpcBound, GrpcExt};
32pub use client::GrpcClient;
33pub use error::GrpcError;
34pub use fake::{FakeGrpc, GrpcCall};
35pub use plugin::{Grpc, GrpcServerBuilder};
36pub use router::MethodRouter;
37pub use transport::GrpcTransport;