Comment on page
Rust quickstart
Once you have a Rust application ready, install Hypertune's Rust crate and the Serde crate:
cargo add hypertune serde
Download the Hypertune CLI:
Then:
- Put it somewhere accessible via your
PATH
- Add execute permissions to it with
chmod +x hypertune
- Right-click to open it
Generate a type-safe client to access your flags by running:
hypertune generate --language rust --output-file-path src/hypertune.rs --token <token>
Replace
<token>
with your project token which you can find in the Settings tab of your project.mod hypertune;
fn main() {
let root_node = hypertune::initialize_hypertune(hypertune::Rec {}, None)
.unwrap()
.root(hypertune::Rec2 {
context: hypertune::Rec3 {
user: hypertune::Rec4 {
id: "test_id".to_string(),
name: "Test".to_string(),
email: "[email protected]".to_string(),
},
},
});
let example_flag = root_node.exampleFlag().get(false);
}
Now you can update the logic for
exampleFlag
from the Hypertune UI without updating your code or waiting for a new build, deployment, app release or service restart.To add a new flag, create it in the Hypertune UI then regenerate the client.
Last modified 18d ago