fn from_str(s: &str) -> Result<Self> {
        let mut splitter = s.splitn(2, '=');
        let arg = splitter.next().unwrap(); // splitn will always have at least 1 item
        let value = splitter.next();

        // For structopt/clap, if you pass a value to a flag which doesn't accept one, it's
        // silently ignored.

        match arg {
            "help" => Ok(UnstableArg::Help),

            "continue-on-errors" => Ok(UnstableArg::ContinueOnErrors),

            "min-crossrefs" => value
                .ok_or_else(|| {
                    "'-Z min-crossrefs <spec>' requires a value but none was supplied".into()
                })
                .and_then(|s| {
                    FromStr::from_str(s).map_err(|e| format!("-Z min-crossrefs: {}", e).into())
                })
                .map(UnstableArg::MinCrossrefs),

            "paper-size" => value
                .ok_or_else(|| {
                    "'-Z paper-size <spec>' requires a value but none was supplied".into()
                })
                .map(|s| UnstableArg::PaperSize(s.to_string())),

            // Re-add this when \write18 gets implemetned
            // "shell-escape" => Ok(UnstableArg::ShellEscapeEnabled),
            _ => Err(format!("Unknown unstable option '{}'", arg).into()),
        }
    }
/// Parse from the argument to -Z
Parse from the argument to -Z
Parse from the argument to - Z
fn from_str(s: &str) -> Result<Self> {
        let mut splitter = s.splitn(2, '=');
        let arg = splitter.next().unwrap(); // splitn will always have at least 1 item
        let value = splitter.next();
        // For structopt/clap, if you pass a value to a flag which doesn't accept one, it's
        // silently ignored.
        match arg {
            "help" => Ok(UnstableArg::Help),
            "continue-on-errors" => Ok(UnstableArg::ContinueOnErrors),
            "min-crossrefs" => value
                .ok_or_else(|| {
                    "'-Z min-crossrefs <spec>' requires a value but none was supplied".into()
                })
                .and_then(|s| {
                    FromStr::from_str(s).map_err(|e| format!("-Z min-crossrefs: {}", e).into())
                })
                .map(UnstableArg::MinCrossrefs),
            "paper-size" => value
                .ok_or_else(|| {
                    "'-Z paper-size <spec>' requires a value but none was supplied".into()
                })
                .map(|s| UnstableArg::PaperSize(s.to_string())),
            // Re-add this when \write18 gets implemetned
            // "shell-escape" => Ok(UnstableArg::ShellEscapeEnabled),
            _ => Err(format!("Unknown unstable option '{}'", arg).into()),
        }
    }
fn from_str ( s : & str ) -> Result < Self > { let mut splitter = s . splitn ( 2 , '=' ) ; let arg = splitter . next ( ) . unwrap ( ) ; // splitn will always have at least 1 item let value = splitter . next ( ) ; // For structopt/clap, if you pass a value to a flag which doesn't accept one, it's // silently ignored. match arg { " " => Ok ( UnstableArg :: Help ) , " " => Ok ( UnstableArg :: ContinueOnErrors ) , " " => value . ok_or_else ( | | { " " . into ( ) } ) . and_then ( | s | { FromStr :: from_str ( s ) . map_err ( | e | format ! ( " " e ) . into ( ) ) } ) . map ( UnstableArg :: MinCrossrefs ) , " " => value . ok_or_else ( | | { " " . into ( ) } ) . map ( | s | UnstableArg :: PaperSize ( s . to_string ( ) ) ) , // Re-add this when \write18 gets implemetned // "shell-escape" => Ok(UnstableArg::ShellEscapeEnabled), _ => Err ( format ! ( " " arg ) . into ( ) ) , } }
Parse from the argument to -Z
Parse from the argument to - Z
s
&str