unwrap-sugar

Crates.iounwrap-sugar
lib.rsunwrap-sugar
version0.1.1
sourcesrc
created_at2022-07-24 14:24:27.359923
updated_at2022-07-24 14:33:28.299771
descriptionJust a simple sugar for unwrapable expressions
homepagehttps://github.com/jedsek/unwrap-sugar
repositoryhttps://github.com/jedsek/unwrap-sugar
max_upload_size
id632021
size1,243,746
Jedsek (Jedsek)

documentation

https://docs.rs/unwrap-sugar

README

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');
Commit count: 6

cargo fmt