[−][src]Crate dispatchtable
dispatchtable is a runtime key based collection that contains references to functions.
Quick Start
use dispatchtable::{Dispatch, DispatchTable}; fn add(p: &(u8, u8)) -> u8 { p.0 + p.1 } fn sub(p: &(u8, u8)) -> u8 { p.0 - p.1 } fn main() { let mut dispatchtable = DispatchTable::new(); dispatchtable.insert("add".to_string(), Box::new(add)); dispatchtable.insert("sub".to_string(), Box::new(sub)); assert_eq!(dispatchtable.call("sub", &(10, 5)), Some(5)); }
Structs
DispatchTable |
Traits
Dispatch | |
DispatchFunction |