toggle 0.2.0

Typed feature toggles.
Documentation
  • Coverage
  • 0%
    0 out of 10 items documented0 out of 7 items with examples
  • Size
  • Source code size: 4.1 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.72 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Documentation
  • peterhj/libtoggle
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • peterhj

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!"); });
}