Rust feature flags installation
Contents
Install the posthog-rs crate by adding it to your Cargo.toml.
Next, set up the client with your PostHog project key.
Blocking client
Our Rust SDK supports both blocking and async clients. The async client is the default and is recommended for most use cases.
If you need to use a synchronous client instead – like we do in our CLI –, you can opt into it by disabling the asynchronous feature on your Cargo.toml file.
In blocking mode, calls to capture and related methods will block until the PostHog event capture API returns – generally this is on the order of tens of milliseconds, but you may want to thread::spawn a background thread when you send an event.
Using feature flags
Boolean feature flags
Multivariate feature flags
Fetching all flags
Feature flag payloads
With person properties
With groups
For B2B applications with group-based flags:
Now that you're evaluating flags, continue with the resources below to learn what else Feature Flags enables within the PostHog platform.
| Resource | Description |
|---|---|
| Creating a feature flag | How to create a feature flag in PostHog |
| Adding feature flag code | How to check flags in your code for all platforms |
| Framework-specific guides | Setup guides for React Native, Next.js, Flutter, and other frameworks |
| How to do a phased rollout | Gradually roll out features to minimize risk |
| More tutorials | Other real-world examples and use cases |