#[derive(SetGet)]
{
// Attributes available to this derive:
#[cvars]
}
Expand description
Generate setters and getters that take cvar names as string.
This does the same thing as cvars! but you can use it on an existing struct.
Initial/default values have to be specified separately.
All types used as cvars have to impl FromStr and Display.
See cvars! for more details about the generated code.
ยงExample
use cvars::SetGet;
#[derive(SetGet)]
pub struct Cvars {
g_rocket_launcher_ammo_max: i32,
g_rocket_launcher_damage: f32,
}
impl Cvars {
pub fn new() -> Self {
Self {
g_rocket_launcher_ammo_max: 20,
g_rocket_launcher_damage: 75.0,
}
}
}