try-let 0.2.0

Proc macro for a basic try-let form
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![feature(proc_macro_hygiene)]
#![feature(bindings_after_at)]

use try_let::try_let;

#[test]
fn bindings_after_at() {
    let nested = Some(("apple", "pear"));

    try_let!(Some(a @ (b, c)) = nested else {
        unreachable!();
    });
    assert_eq!(a, ("apple", "pear"));
    assert_eq!(b, "apple");
    assert_eq!(c, "pear");
}