[][src]Crate const_tweaker

Runtime const tweaking

This library starts a web server at where you can change the values of const variables in your crate.

f64 & bool are the types that are currently supported.


// Tweak `VALUE` when running in debug mode
// This will render a slider in the web GUI because the type here is a `f64`
const VALUE: f64 = 0.0;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize the server at '' when running in debug mode

    // Enter a GUI/Game loop
    loop {
        // ...

        // Print the constant value that can be changed from the website.
        println!("VALUE: {}", VALUE);


Some widgets have customizable options, as seen in the examples below:


// Spawns a slider
const DEFAULT_VALUE: f64 = 0.0;

// Spawns a slider with 10 steps from 0-1
#[const_tweaker::tweak(min = 0.0, max = 1.0, step = 0.1)]
const CUSTOM_VALUE: f64 = 0.0;


// Spawns a checkbox
const DEFAULT_VALUE: bool = true;


// Spaws a textbox
const DEFAULT_VALUE: &str = "Hi";



Launch the const tweaker web service.

Attribute Macros


Expose a const variable to the web GUI so it can be changed from a live setting.