Crates.io | toggle |
lib.rs | toggle |
version | 0.2.0 |
source | src |
created_at | 2016-02-04 16:54:05.81783 |
updated_at | 2016-04-30 05:40:06.13874 |
description | Typed feature toggles. |
homepage | |
repository | https://github.com/peterhj/libtoggle |
max_upload_size | |
id | 4077 |
size | 3,954 |
libtoggle
is a Rust library for feature toggles.
Basic usage:
use toggle::{Toggle, Disabled, Enabled};
struct HelloStruct<MapTg> where MapTg: Toggle<HashMap<String, i32>> {
t: MapTg,
}
fn main() {
let nomap = HelloStruct{
t: Disabled::new(),
}
nomap.t.as_ref().map(|_| { println!("i am a spooky ghost"); });
let mut hasmap = HelloStruct{
t: Enabled::new(HashMap::new()),
};
hasmap.t.as_mut().map(|t| { println!("hello world!"); });
}