Expand description
sift_rs largely contains protobuf-generated code used to interact with Sift’s gRPC API as well as some
utility wrappers. Due to tonic relying on
tokio, it is required that users have tokio installed
in order to communicate with Sift over gRPC.
§Quickstart
Start by installing sift_rs
cargo add sift_rsThen install tokio:
cargo add tokio --features fullThen we can establish a connection to Sift and use one of the protobuf service clients like so:
use sift_rs::{
Credentials, SiftChannelBuilder,
ping::v1::{PingRequest, ping_service_client::PingServiceClient},
};
use std::env;
#[tokio::main]
async fn main() {
let credentials = Credentials::Config {
apikey: env::var("SIFT_TOKEN").unwrap(),
uri: env::var("SIFT_GRPC").unwrap(),
};
let conn = SiftChannelBuilder::new(credentials).build().unwrap();
let mut ping_service = PingServiceClient::new(conn);
let ping_response = ping_service.ping(PingRequest::default()).await.unwrap();
println!("{}", ping_response.into_inner().response);
}Re-exports§
pub use retry::DefaultGrpcRetry;pub use retry::RetryConfig;pub use retry::RetryDecider;pub use retry::RetryExt;pub use retry::Retrying;pub use gen::sift::*;
Modules§
- gen
- Protobuf generated code to interface with Sift’s gRPC API.
- retry
- Generic retry extension for gRPC wrapper services. Generic retry extension for gRPC wrapper services.
- wrappers
- Utility wrappers for select gRPC services. Wrapper modules for Sift’s gRPC services.
Macros§
- metadata
- A macro for easily creating an array of metadata to be provided to Sift.
Structs§
- Sift
Channel Builder - Used to build an instance of SiftChannel.
Enums§
- Compression
Encoding - The compression encodings Tonic supports.
- Credentials
- Specifies the source of credentials for connecting to Sift.
Type Aliases§
- Sift
Channel - A pre-configured gRPC channel to conveniently establish a connection to Sift’s gRPC API.