diff --git a/rust/README.md b/rust/README.md index 92742072..53f03352 100644 --- a/rust/README.md +++ b/rust/README.md @@ -1 +1,11 @@ # Sift Rust + +[![Crates.io](https://img.shields.io/crates/v/sift_rs.svg)](https://crates.io/crates/sift_rs) + +This library offers a Rust API on top of Sift's protocol buffers to ergonomically interface with the Sift gRPC API. + +## Installation + +``` +$ cargo add sift_rs +``` diff --git a/rust/src/lib.rs b/rust/src/lib.rs index f927c259..afb61dc8 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -3,6 +3,26 @@ pub mod gen; /// Preconfigured gRPC utilities to initialize client stubs from the `gen` package. +/// +/// ``` +/// use sift_rs::{ +/// gen::sift::ping::v1::{ping_service_client::PingServiceClient, PingRequest}, +/// grpc::{use_sift_channel, SiftChannelConfig}, +/// }; +/// use std::{env, error::Error}; +/// +/// #[tokio::main] +/// async fn main() -> Result<(), Box> { +/// let uri = env::var("SIFT_URI")?; +/// let apikey = env::var("SIFT_API_KEY")?; +/// let grpc_channel = use_sift_channel(SiftChannelConfig { uri, apikey })?; +/// let response_from_sift = PingServiceClient::new(grpc_channel) +/// .ping(PingRequest {}) +/// .await?; +/// println!("{}", response_from_sift.get_ref().response); +/// Ok(()) +/// } +/// ``` pub mod grpc; /// Error types specific for this library. Note that when using the `gen` module