Recent major versionsVersion 3 of the Rust SDK includes breaking changes. The most significant changes involve the HTTP transport layer, TLS/crypto feature flags, and some API refinements. To learn how to upgrade, read the Rust SDK 2.x to 3.0 migration guide.Version 2 of the Rust SDK makes the
rustls dependency optional. There are no changes to the SDK API.SDK quick linksLaunchDarkly’s SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and a sample application:
| Resource | Location |
|---|---|
| SDK API documentation | SDK API docs |
| Supported SDK Versions | Rust server SDK |
| GitHub repository | rust-server-sdk |
| Sample application | Rust |
| Published module | crates.io |
Get started
After you complete the Get started process, follow these instructions to start using the LaunchDarkly SDK in your Rust application.Install the SDK
First, install the LaunchDarkly SDK as a dependency in your application.Initialize the client
Next, import the LaunchDarkly client in your application code:The Rust SDK uses an SDK keyThe Rust SDK uses an SDK key. Keys are specific to each project and environment. They are available on the SDK keys page under Settings. To learn more about key types, read Keys.
tokio crate to provide a default runtime and as such it is a required dependency.
Only create one instance of client.
Here’s how:
Config.
Evaluate a context
You can useclient to check which variation a particular context will receive for a given feature flag.
Here’s how:
Shut down the client
Shut down the client when your application terminates. To learn more, read Shutting down.Supported features
This SDK supports the following features:- SDK configuration, including
- Anonymous contexts and users
- Context configuration
- Data saving mode
- Flag variation evaluation
- Flag variation evaluation details
- Flushing events
- Getting all flags
- Identifying and changing contexts
- Logging configuration
- Migrations
- Offline mode
- Private attributes
- Relay Proxy configuration
- Secure mode
- Tracking custom events
- Service endpoint configuration
- Shutting down
- Test data sources
- Web proxy configuration