#sugar #unwrap #expressions #unwrapable

unwrap-sugar

Just a simple sugar for unwrapable expressions

2 releases

0.1.1 Jul 24, 2022
0.1.0 Jul 24, 2022

#13 in #sugar

MIT license

1MB
68 lines

Contains (WOFF font, 400KB) doc/NanumBarunGothic.ttf.woff2, (WOFF font, 135KB) doc/FiraSans-Medium.woff2, (WOFF font, 130KB) doc/FiraSans-Regular.woff2, (WOFF font, 82KB) doc/SourceSerif4-Bold.ttf.woff2, (WOFF font, 77KB) doc/SourceSerif4-Regular.ttf.woff2, (WOFF font, 45KB) doc/SourceCodePro-It.ttf.woff2 and 3 more.

unwrap-sugar

This just unwraps all expression in the macro simply.
The expressions must be unwrapable.

Usage

unwrap_sugar! {
    // Immutable
    a = Some('a');

    // Mutable
    mut b = Some('b');

    // Immutable with Type
    c:char = {
        Some('C').map(|x| x.to_ascii_lowercase())
    };
};

assert_eq!(a, 'a');
assert_eq!(b, 'b');
assert_eq!(c, 'c');

lib.rs:

Usage

This just unwraps all expression in the macro simply.
The expressions must be unwrapable.

unwrap_sugar! {
    // Immutable
    a = Some('a');

    // Mutable
    mut b = Some('b');

    // Immutable with Type
    c:char = {
        Some('C').map(|x| x.to_ascii_lowercase())
    };
};

assert_eq!(a, 'a');
assert_eq!(b, 'b');
assert_eq!(c, 'c');

No runtime deps