Skip to content

harryfei/sugar-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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];

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

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

// hashmap comprehension
let hm2 = m!{i => i + 1, for i in 1..4};

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

if cmp!(1, < num, < 3) {
    println!("num is between 1 and 3");
}

More detail in sugar's documentation.

About

Rust syntax sugar collections.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages