toggle

Crates.iotoggle
lib.rstoggle
version0.2.0
sourcesrc
created_at2016-02-04 16:54:05.81783
updated_at2016-04-30 05:40:06.13874
descriptionTyped feature toggles.
homepage
repositoryhttps://github.com/peterhj/libtoggle
max_upload_size
id4077
size3,954
Peter Jin (peterhj)

documentation

https://peterhj.github.io/libtoggle/toggle/

README

libtoggle

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!"); });
}
Commit count: 3

cargo fmt