Macro cucumber::try_destructure [] [src]

macro_rules! try_destructure {
    ($r: ident) => { ... };
}

Destructure a vector of InvokeArgument into a tuple of values, or a bad InvokeResponse, similar to normal try!

Will either short circult return an InvokeArgument::Fail, describing either improper arg count or improper arg type, or will yield the tuple of values

Reminder: Tuple of one value is represented as (t,): (Type,)

Example

#[macro_use]
extern crate cucumber;

use cucumber::{
  InvokeArgument,
};

fn main() {
  fn do_work() {
    let args = vec![
      InvokeArgument::from_str("1"),
      InvokeArgument::from_str("2"),
      InvokeArgument::None
    ];
    let (x, y, z): (u32, u32, bool) = try_destructure!(args);

    assert_eq!(x, 1);
    assert_eq!(y, 2);
    assert_eq!(z, false);
  }
}