Skip to main content
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.
This topic documents how to get started with the server-side Rust SDK, and links to reference information on all of the supported features.
SDK quick linksLaunchDarkly’s SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and a sample application:
ResourceLocation
SDK API documentationSDK API docs
Supported SDK VersionsRust server SDK
GitHub repositoryrust-server-sdk
Sample applicationRust
Published modulecrates.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.
After you install and import the SDK, create a single, shared instance of the LaunchDarkly client. Specify your SDK key here because your application is authorized to connect to LaunchDarkly, your application, and your environment. After you have created the client, start the client process and wait for the client to initialize. This SDK depends on the tokio crate to provide a default runtime and as such it is a required dependency. Only create one instance of client. Here’s how:
To learn more about the specific configuration options available in this SDK, read Config.
client must be a singletonIt’s important to make client a singleton for each LaunchDarkly project. The client instance maintains internal state that allows LaunchDarkly to serve feature flags without making any remote requests. Do not instantiate a new client with every request.If you have multiple LaunchDarkly projects, you can create one LDClient for each. In this situation, the clients operate independently. For example, they do not share a single connection to LaunchDarkly.

Evaluate a context

You can use client 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: