Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub struct CmdLineMethod<'s, S> {
- cmd: String,
- handler: &'static Fn(&'s mut Iterator<Item = String>, &'s S) -> i32,
- }
- impl <'s, S> CmdLineMethod<'s, S> {
- pub fn new<F>(s: String, f: F) -> Self
- where
- F: Fn(&'s mut Iterator<Item = String>, &'s S) -> i32 + 'static,
- {
- Self { cmd: s, handler: f }
- }
- }
- struct Settings {
- }
- fn version(_iter: &mut Iterator<Item = String>, _s: &Settings) -> i32 {
- println!("ripmitool version 0.0.0");
- 0
- }
- fn main() {
- let cmdline_methods = [
- CmdLineMethod::new("-V".to_string(), &version),
- ];
- //cmdline_methods[0].handler();
- }
Add Comment
Please, Sign In to add comment