Struct docopt::Decoder [] [src]

pub struct Decoder { /* fields omitted */ }

Decoder for ArgvMap into your own Decodable types.

In general, you shouldn't have to use this type directly. It is exposed in case you want to write a generic function that produces a decodable value. For example, here's a function that takes a usage string, an argv and produces a decodable value:

use docopt::Docopt;
use rustc_serialize::Decodable;

fn decode<D: Decodable>(usage: &str, argv: &[&str])
                        -> Result<D, docopt::Error> {
           .and_then(|d| d.argv(argv.iter().cloned()).decode())

Trait Implementations

impl Decoder for Decoder