Documentation Index
Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This topic explains how to adapt code that currently uses a 2.x version of the Rust server-side SDK to use version 3.0 or later. Version 3.0 includes breaking changes. The most significant changes involve the HTTP transport layer, TLS/crypto feature flags, and some API refinements. To learn more about the latest release, visit the SDK’s GitHub repository.Understanding changes to Cargo features
The most impactful change in version 3.0 is the restructuring of Cargo feature flags. The default features have changed, and several new features have been introduced to give you more control over TLS backends and cryptographic implementations. Here is a summary of the feature flag changes: | v2 Feature | v3 Feature| Notes |
|---|
rustls (default)
| hyper-rustls-native-roots (default)
| Renamed to clarify TLS backend and root certificate source |
| N/A
| hyper-rustls-webpki-roots
| New option: uses rustls with bundled WebPKI root certificates |
| N/A
| native-tls
| New option: uses the platform’s native TLS implementation |
| N/A
| hyper
| Base HTTP feature for hyper-based transports |
| N/A
| crypto-aws-lc-rs (default)
| Cryptographic backend, previously always included |
| N/A
| crypto-openssl
| New alternative: uses OpenSSL for cryptographic operations |
| event-compression (opt-in)
| event-compression (default)
| Now enabled by default |
If you were using default features in v2.x, the defaults in v3.0 provide equivalent behavior. No changes to your Cargo.toml are needed in this case:
rustls feature, update to the new feature name:
Understanding the new transport layer
Version 3.0 introduces a newlaunchdarkly-sdk-transport crate that provides the HttpTransport trait. This trait abstracts the HTTP transport layer, replacing the previous approach of directly using hyper connectors.
The built-in implementation is HyperTransport. This is used by default when you enable any of the hyper-based features, including hyper-rustls-native-roots, hyper-rustls-webpki-roots, or native-tls.
If you were using the SDK with default settings and not customizing the HTTP connector, this change is transparent. The SDK automatically creates the appropriate HyperTransport based on your enabled features.
If you were providing a custom hyper connector, you now need to wrap it in a HyperTransport or implement the HttpTransport trait directly:
Understanding changes to data source configuration
The streaming and polling data source builders now use theHttpTransport trait instead of a generic connector type parameter.
The type signatures have changed:
StreamingDataSourceBuilder<C>is nowStreamingDataSourceBuilder<T: HttpTransport>PollingDataSourceBuilder<C>is nowPollingDataSourceBuilder<T: HttpTransport>
.https_connector(connector)is now.transport(transport)
Understanding changes to event processor configuration
The event processor builder now uses theHttpTransport trait instead of a generic connector type parameter.
The type signature has changed:
EventProcessorBuilder<C>is nowEventProcessorBuilder<T: HttpTransport>, with a default type parameter
.https_connector(connector)is now.transport(transport)
compress_events now defaults to true, while it defaulted to false in v
- If you previously relied on the default of no compression, you need to explicitly disable it.
Understanding changes to Flag
DetailConfig TheFlagDetailConfig type has been updated. The client_side_only() method has been removed and replaced with a more flexible flag_filter method that accepts FlagFilter bitflags.
The new FlagFilter type supports:
FlagFilter::CLIENTfilters for flags available to client-side SDKs. It replacesclient_side_only().FlagFilter::MOBILEfilters for flags available to mobile SDKs. This is a new filter.
OR operator.
Here is an example:
Understanding changes to secure_mode_hash
The secure_mode_hash method’s return type has changed from String to Result<String, String>. This change reflects the fact that the cryptographic operation can fail.
Additionally, secure_mode_hash is now only available when either the crypto-aws-lc-rs or crypto-openssl feature is enabled.
Here is an example:
Understanding changes to the `Event
Processor` trait If you have implemented a customEventProcessor, you need to add a new required method: flush_blocking. This method performs a synchronous flush of pending events with a timeout.
The signature is:
true if the flush completed successfully, or false if it timed out.
If you are using the SDK’s built-in event processor or
NullEventProcessor, no changes are required. This only affects custom EventProcessor trait implementations.