#proc-macro

leetcode_test

Some useful macros and definition for exercising in leetcode

3 releases

0.1.2 Aug 14, 2020
0.1.1 Dec 29, 2018
0.1.0 Dec 29, 2018

#260 in Procedural macros

Download history 44/week @ 2021-08-07 18/week @ 2021-08-14 36/week @ 2021-08-21 8/week @ 2021-08-28 32/week @ 2021-09-11 12/week @ 2021-09-18 4/week @ 2021-09-25 4/week @ 2021-10-02 29/week @ 2021-10-09 10/week @ 2021-10-16 40/week @ 2021-10-23 7/week @ 2021-10-30 10/week @ 2021-11-06 14/week @ 2021-11-20

83 downloads per month
Used in leetcode_prelude

MIT license

6KB
104 lines

leetcode_prelude

Some useful macros and definition for exercising in LeetCode.

How to use

Add following lines to your Cargo.toml.

[dependencies]
leetcode_prelude = "^0.2"

Examples

Binary tree initialization

use leetcode_prelude::btree;

let btree = btree![1, 2, 2, null, null, 3, 3];

Linked list initialization

use leetcode_prelude::linkedlist;

let linkedlist = linkedlist![1, 2, 3];

Generate test code from leetcode's json

use leetcode_prelude::leetcode_test;

leetcode_test!(
     ["Trie", "insert", "search"]
     [[], ["apple"], ["apple"]]
     [null, null, true]
)

Create a Vec<String>

use leetcode_prelude::vec_string;

let vec = vec_string!["1", "2", "3"];

assert_eq_sorted

use leetcode_prelude::assert_eq_sorted;

assert_eq_sorted!(vec![1, 2], vec![2, 1]);

Dependencies

~445–710KB
~15K SLoC

6_