pub type FnFree<'a> = &'a dyn Fn(&str);Expand description
Type for a closure for free arguments.
Using RefCell to change the captured environment is required. While it isn’t strictly required, it is required if we want to reuse the closure.
(technically, this is a function pointer, not a closure, but the syntax creates the function pointer)
Example:
use std::cell::RefCell;
use getoptions_long::*;
let args: Vec<String> = vec!["foo", "bar", "baz"].into_iter().map(|x| x.to_string()).collect();
let free_args = RefCell::new(vec![]);
let result = get_options(&mut [
Opt::Free (&|arg| free_args.borrow_mut().push(arg.to_string())),
], &args);
// ...