sugar

Crates.iosugar
lib.rssugar
version0.2.0
sourcesrc
created_at2018-01-08 14:46:24.916084
updated_at2018-04-03 05:32:27.28725
descriptionRust syntax sugar collections.
homepage
repositoryhttps://github.com/fangyuanziti/sugar-rs.git
max_upload_size
id45978
size7,564
Harry (harryfei)

documentation

https://docs.rs/sugar/

README

Sugar

Syntax sugar to make your Rust life more sweet.

Usage

use sugar::*;

Overview

use sugar::*;

// vec of boxed value
let vb1 = vec_box![1, 2, 3];

// list comprehension
let vb2 = c![Box::new(i), for i in 1..4];

// hashmap construction
let hm1 = hashmap!{
    1 => 2,
    2 => 3,
    3 => 4,
};

// hashmap comprehension
let hm2 = c![i => i + 1, for i in 1..4];

let _ = max!(1, 2, 3);
let _ = min!(1, 2, 3);

if cmp!(1, < num, < 3) {
    println!("hello world");
}

More detail in sugar's documentation.

Commit count: 26

cargo fmt