Guest User

Untitled

a guest
Jan 19th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. pub struct CmdLineMethod<'s, S> {
  2. cmd: String,
  3. handler: &'static Fn(&'s mut Iterator<Item = String>, &'s S) -> i32,
  4. }
  5.  
  6. impl <'s, S> CmdLineMethod<'s, S> {
  7. pub fn new<F>(s: String, f: F) -> Self
  8. where
  9. F: Fn(&'s mut Iterator<Item = String>, &'s S) -> i32 + 'static,
  10. {
  11. Self { cmd: s, handler: f }
  12. }
  13. }
  14.  
  15. struct Settings {
  16.  
  17. }
  18.  
  19. fn version(_iter: &mut Iterator<Item = String>, _s: &Settings) -> i32 {
  20. println!("ripmitool version 0.0.0");
  21. 0
  22. }
  23.  
  24. fn main() {
  25. let cmdline_methods = [
  26. CmdLineMethod::new("-V".to_string(), &version),
  27. ];
  28.  
  29. //cmdline_methods[0].handler();
  30. }
Add Comment
Please, Sign In to add comment