cipherstash_grpc/
lib.rs

1#[path = ""]
2pub mod api {
3    #[path = "generated/stash.grpc.v1.documents.rs"]
4    pub mod documents;
5
6    #[path = "generated/stash.grpc.v1.collections.rs"]
7    pub mod collections;
8
9    #[path = "generated/stash.grpc.v1.indexes.rs"]
10    pub mod indexes;
11
12    #[path = "generated/stash.grpc.v1.queries.rs"]
13    pub mod queries;
14
15    include!("generated/stash.grpc.v1.rs");
16}
17
18pub use tonic;
19
20#[cfg(feature = "wasm")]
21pub use cipherstash_grpc_web_client as web_client;
22
23#[cfg(feature = "native")]
24// This impl gets cut out when removing the "transport" feature from tonic-build but is useful
25// to connect to a Channel like you would when using this natively.
26impl api::api_client::ApiClient<tonic::transport::Channel> {
27    #[doc = r" Attempt to create a new client by connecting to a given endpoint."]
28    pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
29    where
30        D: std::convert::TryInto<tonic::transport::Endpoint>,
31        D::Error: Into<tonic::codegen::StdError>,
32    {
33        let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
34        Ok(Self::new(conn))
35    }
36}