doe 0.2.32

doe is a powerful Rust crate designed to enhance development workflow by providing an extensive collection of useful macros and utility functions. It not only simplifies common tasks but also offers convenient features for clipboard management,state management,keyboard input, and mouse interaction.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
# doe

[![Crates.io](https://img.shields.io/crates/v/doe.svg)](https://crates.io/crates/doe)
[![Rust](https://img.shields.io/badge/rust-1.56.1%2B-blue.svg?maxAge=3600)](https://gitlab.com/andrew_ryan/doe)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitlab.com/andrew_ryan/doe/-/raw/master/LICENSE)

[![](https://gitlab.com/andrew_ryan/doe/-/raw/master/doe.svg)](https://docs.rs/doe)

doe is a powerful Rust crate designed to enhance development workflow by providing an extensive collection of useful macros and utility functions.
# Features

### utils

```
cargo add doe -F utils
```
allow you to perform various operations with ease, such as string manipulation, urlencode urldecode,hex encode decode,base43 encode decode, and error management.
### clip

```
cargo add doe -F clip
```
simplifies clipboard management, enabling you to effortlessly interact with the system clipboard.
### mouse

```
cargo add doe -F mouse
```
offers intuitive and easy-to-use functions for simulating mouse actions.
### keyboard

```
cargo add doe -F keyboard
```
offers simulating keyboard input action with easy-to-use functions.
### clip

set and get clipboard text
```
cargo add doe -F clip
```
### kcm

kcm is short feature for keyboard clipboard mouse together
```
cargo add doe -F kcm
```
### xlsx

read edit write xlsx file
```
cargo add doe -F xlsx
```
### docx

read edit docx file
```
cargo add doe -F docx
```

# Examples

### docx_replace

```rust
//finds all 'name' and replace with 'andrew'
use doe::*;
docx::docx_replace("./name.docx","name","andrew").unwrap();
docx::docx_get_content("./name.docx").unwrap().dprintln();
docx::docx_remove_read_only("./name.docx").unwrap();
```

### mouse automater

```rust
fn main() {
    use doe::mouse;
    let script = r#"
move_to::217::135
sleep::1
move_to_press_left::189::137
sleep::1
move_to_press_left::198::185
sleep::1
move_drag::655::343::678::330
sleep::1
 # script comment
move_to_paste::479::715::page demo is ok
    "#
    .trim();
    mouse::mouse_automater(script);
}
```
### mouse press left drag

 ```rust
fn main(){
    use doe::mouse::mouse_drag;
    mouse_press_left_drag((543,446).into(), (590,460).into());
    mouse_drag((543,446).into(), (590,460).into(),"left");
}
```
```rust
fn main()->doe::DynError{
    use doe::clipboard::get_clipboard;
    use doe::clipboard::set_clipboard;
    set_clipboard("rust").unwrap();
    let clip = get_clipboard().unwrap();
    assert_eq!("rust",clip);
    Ok(())
}
```
```
cargo add doe -F keyboard
```
 ## keyboard example
 ```rust
fn main(){
    use doe::keyboard::key_press;
    use doe::keyboard::key_release;
    use doe::keyboard::listen_mouse_position;
    use doe::keyboard::get_mouse_position;
    use doe::keyboard::listen_keybord;
 
    use doe::keyboard::KeyCode;
    key_press(KeyCode::COMMAND);
    key_press(KeyCode::V);
    key_release(KeyCode::V);
    // listen key press and release
    listen_keybord();
}
```
## control mouse

```
cargo add doe -F mouse
#arch linux

sudo pacman -S xdotool
#Fedora OR Red Hat

sudo dnf install libxdo-devel
#Ubuntu OR Debian 

sudo apt install libxdo-dev
#Cargo.toml add

[build]
rustflags = ["-L", "/usr/local/lib"]
#OR Cargo.toml add

[build]
rustflags = ["-l", "xdo"]
```
```rust
fn main()->doe::DynError{
    use std::time::Duration;
    use doe::mouse::press;
    move_to(300, 700);
    press("left");
    move_to_with_duration(0, 0,Duration::from_secs(5));
    move_and_press_right(800,900);
    press("right");
    Ok(())
}
```

## implments Bts struct and bts! macro for Box\<dyn Fn()> trait object

```rust
fn main() {
    use doe::DebugPrint;
    use doe::bfn;
    use doe::Bfn;
    #[derive(Debug)]
    struct Demo<'a>{
        name:&'a str
    }
    let f0 = bfn!(||{println!("ok");});
    f0.call();
    fn func()->Demo<'static>{
        let d = Demo{name: "andrew"};
        d
    }
    let f1 = bfn!(func);
    f1.call().println();

    fn sum()->usize{
        9+89
    }
    let f2 = Bfn::new(Box::new(sum));//or bfn!(sum);
    f2.call().println();
}
```
## implments Bts struct and bts! macro for Box\<dyn ToString> trait object

```rust
fn main() {
    use doe::DebugPrint;
    use doe::Bts;
    use doe::bts;
    let mut s:Bts =  bts!("Trait Object, it's ");
    s.push(bts!(100));
    s.push_str("% safe");
    s.println();//"Trait Object, it's 100% safe"
    s.as_bytes().println();//[84, 114, 97, 105, 116, 32, 79, 98, 106, 101, 99, 116, 44, 32, 105, 116, 39, 115, 32, 49, 48, 48, 37, 32, 115, 97, 102, 101]
    s.chars().println();//['T', 'r', 'a', 'i', 't', ' ', 'O', 'b', 'j', 'e', 'c', 't', ',', ' ', 'i', 't', '\'', 's', ' ', '1', '0', '0', '%', ' ', 's', 'a', 'f', 'e']
    let b = Into::<Bts>::into("b".to_string());
    let b = Bts::from("demo");
}
```
## implmemt Debug,Display,Clone,Default,Drop trait for Struct

```rust
fn main() {
    use std::sync::{Arc, Mutex};
    use doe::*;
    struct Doe{
        pub name:String,
        pub nickname: Box<str>,
        key:Arc<Mutex<usize>>
    }
    impl_display!(Doe,name,nickname,key);
    impl_debug!(Doe,name,nickname,key);
    impl_default!(Doe,name,nickname,key);
    impl_clone!(Doe,name,nickname,key);
    impl_drop!(Doe,name,nickname,key);
    let d = Doe{name:"andrew".to_string(), nickname: Box::from("func"),key:Arc::new(Mutex::new(15))};
    let d1 = Doe::default();
    println!("{:?}",d);
    println!("{}",d1);
}
```
## implment format for impl ToString

```rust
fn main() {
    use doe::Print;
    use doe::Str;
    use doe::targets;
    "this is a {s},I like Trait Object {p}%"
    .format(vec![(Box::new("{s}"),Box::new("demo")),(Box::new("{p}"),Box::new(100))]).println();//this is a demo,I like Trait Object 100%
    "this is a {d},I like Trait Object {p}}%"
        .format(targets!{"{d}"=>"demo","{p}"=>100})
        .println(); //this is a demo,I like Trait Object 100%
}
```
## implment print println eprint eprintln for impl Display, impl Debug

```rust
use doe::Print;
use doe::DebugPrint;
"printable text".print();//impl Display
"printable text".println();
"printable text".eprintln();
#[derive(Debug)]

struct DebugPrintDemo{}//impl Debug
let d = DebugPrintDemo{};
d.dprint();
d.dprintln();
d.deprintln();
```

## implment targets! for return Vec<(Box\<dyn ToString>,Box\<dyn ToString>)>

```rust
fn main() {
    use doe::targets;
    use doe::Print;
    use doe::Str;
    "this is a {d},I like Trait Object {p}}%"
        .format(targets!{"{d}"=>"demo","{p}"=>100})
        .println(); //this is a demo,I like Trait Object 100%
}
```
## run timer by send stop_massge by channel

```rust
use std::sync::mpsc;
use std::thread;
use std::time::Duration;

fn main() {
    let (sender, receiver) = mpsc::channel::<bool>();
    let t1 = thread::spawn(move || {
        thread::sleep(Duration::from_secs(5));
        sender.send(true).unwrap();
    });
    let t2 = thread::spawn(move || {
        run_timer_by_channel(Duration::from_secs(1), receiver, Box::new(|| {
            println!("running..");
        }));
    });
    t1.join().expect("Thread panicked");
    t2.join().expect("Thread panicked");
}
 ```
## run timer by shared state

 ```rust
fn main() {
    use std::sync::{Arc, Mutex};
    let run_state = Arc::new(Mutex::new(true));

    let t1 = std::thread::spawn({
        let run_state = Arc::clone(&run_state);
        move || {
            std::thread::sleep(std::time::Duration::from_secs(5));
            *run_state.lock().unwrap() = false;
        }
    });

    let t2 = std::thread::spawn({
        let run_state = Arc::clone(&run_state);
        move || {
            run_timer_by_state(
                std::time::Duration::from_secs(1),
                run_state,
                Box::new(|| {
                    // Function body goes here
                    println!("Running...");
                }),
            );
        }
    });

    // Wait for the threads to finish
    t1.join().expect("Thread panicked");
    t2.join().expect("Thread panicked");

}
 ```
## run timer anguments :start_time:Instant,step_time:Duration,stop_time:Duration,func:Box<dyn Fn()>

 ```rust
fn run(){
     println!("running ");
}
run_timer(std::time::Instant::now(),std::time::Duration::from_secs(1),std::time::Duration::from_secs(5),Box::new(run));
 ```
## useage of fs module

```rust
fn main() {
    use doe::fs::*;
    use doe::DebugPrint;
    use doe::Str;
    use std::ops::Deref;
    use doe::fs::home_dir;
    use doe::DebugPrint;
    home_dir().display().dprintln();

    // append data to file
    append_data_to_file("demo.txt", "demo".as_bytes().to_vec()).unwrap();

    // get all files and folders
    walk_dir(".".to_path().deref()).unwrap().println();

    // get all folders
    walk_dir_get_files(".".to_path().deref()).unwrap().println();

    // get all folders
    walk_dir_get_folders(".".to_path().deref())
        .unwrap()
        .println();

    //move file the directory to a new directory
    move_file(
        "/Users/ryanandrew/code/test/t1/demo.zip".to_path().deref(),
        "/Users/ryanandrew/code/test/t2/d2.zip".to_path().deref(),
    )
    .unwrap();

    //copy file the directory to a new directory
    copy_file(
        "/Users/ryanandrew/code/test/t1/demo.zip".to_path().deref(),
        "/Users/ryanandrew/code/test/t2/d2.zip".to_path().deref(),
    )
    .unwrap();
    //move all files in the directory to a new directory
    move_folder(
        "/Users/ryanandrew/code/test/t1".to_path().deref(),
        "/Users/ryanandrew/code/test/t2/t1".to_path().deref(),
    )
    .unwrap();

    //copy all files in the directory to a new directory
    copy_folder(
        "/Users/ryanandrew/code/test/d1".to_path().deref(),
        "/Users/ryanandrew/code/test/d2".to_path().deref(),
    )
    .unwrap();
}
```
## like pythons os.system() function

```rust
pub fn run() {
    //linux and macos
    system!("ping bing.com");
    // in windows
    system_powershell!("ls");
    system!("python -m http.server"); //run in cmd
}
```
## implment cut format for str and String

 ```rust
use doe::Str;
let a = "this is a demo {}";
let c = a.cut(-1,-2,1);
let f = a.format("so {}").format("how good is");
println!("{:?}",f);
println!("{:?}",c);
 ```
## convert type

 ```rust
  use doe::*;
  let s = as_to!(5., i64);
  assert_eq!(5, s);
 ```
##  if type is i8 return true

 ```rust
 use doe::*;
 assert_eq!(macros::is_i8(&5_i8),true);
 ```
##  if type is i16 return true

 ```rust
 use doe::*;
 assert_eq!(macros::is_i16(&5_i16),true);
 ```
##  if type is i32 return true

 ```rust
 use doe::*;
 assert_eq!(macros::is_i32(&5_i32),true);
 ```
##  if type is i64 return true

 ```rust
 use doe::*;
 assert_eq!(macros::is_i64(&5_i64),true);
 ```
##  if type is i128 return true

 ```rust
 use doe::*;
 assert_eq!(macros::is_i128(&5_i128),true);
 ```
##  if type is f32 return true

 ```rust
 use doe::*;
 assert_eq!(macros::is_f32(&5.0_f32),true);
 ```
##  if type is f64 return true

 ```rust
 use doe::*;
 assert_eq!(macros::is_f64(&5.0_f64),true);
 ```
## returns a raised to the b power

 ```rust
 use doe::*;
 let p = powf!(2.,2.);
 assert_eq!(p,4.0);
 ```
## get argument and collect into Vec\<String\>

 ```rust
 use doe::*;
 //cargo run -- -n 100
 let arg = args!();
 assert_eq!(arg,vec![format!("-n"),format!("100")]);
 ```
## get user input from terminal,return String

 ```rust
 use doe::*;
 let s = input!();
 println!("{:?}",s);
 ```
## Spliy &str by spliter and collect into Vec\<String\>

 ```rust
 use doe::*;
 let s = split_to_vec!("aa.bb",".");
 assert_eq!(s,vec![format!("aa"),format!("bb")]);
 ```
## read .csv file and Collect into Vec\<Vec\<String\>\>

 ```rust
 use doe::*;
let s = read_csv!("./data.csv");
assert_eq!(s,vec![vec![format!("a"), format!("b"), format!("c")],vec![format!("1"), format!("2"), format!("3")],vec![format!("10"), format!("20"), format!("30")]]);
 ```
## sorted new Vec

 ```rust
 use doe::*;
 let s1 = sorted!(vec![1.2, 2.6, 0.2]);
 let s2 = sorted!(vec![8, 1_i128, 5_i128]);
 assert_eq!(s1,vec![0.2,1.2,2.6]);
 assert_eq!(s2,vec![1,5,8]);
 ```
## sorted and deduped Vec

 ```rust
 use doe::*;
 let s1 = deduped_sorted!(vec![1.2, 1.2,2.6, 0.2]);
 let s2 = deduped_sorted!(vec![8, 1_i128,8,5_i128]);
 assert_eq!(s1,vec![0.2,1.2,2.6]);
 assert_eq!(s2,vec![1,5,8]);
 ```
## parse Vec element to type, parse Vec\<&str\> Collect to Vec\<type\>

 ```rust
 use doe::*;
let v1: Vec<f64> = vec_element_parse!(vec!["15.", "2.9"], f64);
let v2: Vec<i128> = vec_element_parse!(vec!["15", "2"], i128);
let v3: Vec<f32> = vec_element_parse!(vec![".15", ".2"], f32);
assert_eq!(vec![15.0, 2.9], v1);
assert_eq!(vec![15, 2], v2);
assert_eq!(vec![0.15, 0.2], v3);
 ```
## convert vec item to String,return Vec\<String\>

 ```rust
 use doe::*;
let v1 = vec_element_to_string!(vec!["15.", "2.9"]);
let v2 = vec_element_to_string!(vec![15, 2]);
let v3 = vec_element_to_string!(vec![0.15, 0.2]);
assert_eq!(vec!["15.", "2.9"], v1);
assert_eq!(vec!["15", "2"], v2);
assert_eq!(vec!["0.15", "0.2"], v3);
 ```
## return the array elements arranged from outermost elements to the middle element, traveling clockwise (n x n)

 ```rust
 use doe::*;
let v1 = snail_sort!(vec![vec![1, 2, 3], vec![4, 5, 6], vec![7, 8, 9]]);
let v2 =  snail_sort!(vec![vec![1.1, 2.1, 3.1],vec![4.1, 5.1, 6.1],vec![7.1, 8.1, 9.1]]);
assert_eq!(vec![1, 2, 3, 6, 9, 8, 7, 4, 5], v1);
assert_eq!(vec![1.1, 2.1, 3.1, 6.1, 9.1, 8.1, 7.1, 4.1, 5.1], v2);
 ```
## mutiply two matrix

 ```rust
 use doe::*;
let m1 = [[1, 2, -1], [-1, 3, 4], [1, 1, 1]].map(|s| s.to_vec()).to_vec();
let m2 = [[5, 6], [-5, -6], [6, 0]].map(|s| s.to_vec()).to_vec();
let mul_result1 = multiply_matrix!(&m1, &m2);
assert_eq!(mul_result1, [[-11, -6], [4, -24], [6, 0]]);
let m11 = [[1., 2., -1.], [-1., 3., 4.]].map(|s| s.to_vec()).to_vec();
let m22 = [[5.5, 6.], [-5., -6.5]].map(|s| s.to_vec()).to_vec();
let mul_result2 = multiply_matrix!(&m11, &m22);
assert_eq!(mul_result2, [[-4.5, -7.0], [-20.5, -25.5]]);
let m111 = [[1., 2., -1.], [-1., 3., 4.]].map(|s| s.to_vec()).to_vec();
let m222 = [[5.5, 6.]].map(|s| s.to_vec()).to_vec();
let mul_result3 = multiply_matrix!(&m111, &m222);
assert_eq!(mul_result3, [[5.5, 6.0]]);
 ```
## find the fist element and remove

 ```rust
 use doe::*;
let v1 = vec_element_remove!(vec!["15.", "2.9"], "2.9");
let v2 = vec_element_remove!(vec![15, 2, 3, 2], 2);
let v3 = vec_element_remove!(vec![0.15, 0.2, 0.2], 0.2);
assert_eq!(vec!["15."], v1);
assert_eq!(vec![15, 3, 2], v2);
assert_eq!(vec![0.15, 0.2], v3);
 ```
## find element position and collect into Vec<usize>

 ```rust
 use doe::*;
let v1 = vec_element_position_all!(vec![1, 2, 5, 3, 6, 2, 2], 2);
assert_eq!(v1, vec![1, 5, 6]);
let v2 = vec_element_position_all!(vec!["0".to_string(),"4".to_string(),"7".to_string(),"7".to_string(),], "7".to_string());
assert_eq!(v2, vec![2,3]);
 ```
## slice vec by range

 ```rust
 use doe::*;
let v1 = vec_slice!(vec![1.2, 1.5, 9.0], [..2]);
let v2 = vec_slice!(vec![1, 1, 9, 90, 87, 0, 2], [4..6]);
let v3 = vec_slice!(vec![1.2, 1.5, 9.0], [..]);
let v4 = vec_slice!(vec![1.2, 1.5, 9.0], [1..]);
let v5 = vec_slice!(vec!["1", "2", "3", "4", "5"], [2..5]);
let v6 = vec_slice!(vec!["1".to_string(),"2".to_string(),"3".to_string()], [1..]);
assert_eq!(v1, vec![1.2, 1.5]);
assert_eq!(v2, vec![87, 0]);
assert_eq!(v3, vec![1.2, 1.5, 9.0]);
assert_eq!(v4, vec![1.5, 9.0]);
assert_eq!(v5, vec!["3", "4", "5"]);
assert_eq!(v6,vec!["2".to_string(),"3".to_string()]);
 ```
## clone element by index

 ```rust
 use doe::*;
let v1 = vec_element_clone!(vec!["15.", "2.9"], 1);
let v2 = vec_element_clone!(vec![15, 2, 3, 2], 2);
let v3 = vec_element_clone!(vec![0.15, 0.2, 0.2], 0);
let v4 = vec_element_clone!(vec![format!("1"),format!("2"),format!("3"),format!("4"),format!("5")],4);
assert_eq!("2.9", v1);
assert_eq!(3, v2);
assert_eq!(0.15, v3);
assert_eq!(format!("5"), v4);
 ```
## remove file or folder

 ```rust
remove_file_or_folder!("./demo.txt");
remove_file_or_folder!("./target");
 ```
## get vec type ,return string type value

 ```rust
 use doe::*;
assert_eq!(vec_type!(vec![0.2_f64]), format!("Vec<f64>"));
assert_eq!(vec_type!(vec![0.2_f32]), format!("Vec<f32>"));
assert_eq!(vec_type!(vec![2_i32]), format!("Vec<i32>"));
assert_eq!(vec_type!(vec![2_i128]), format!("Vec<i128>"));
assert_eq!(vec_type!(vec![2_isize]), format!("Vec<isize>"));
assert_eq!(vec_type!(vec![2_usize]), format!("Vec<usize>"));
 ```
 ## convert vec elements type
 ```rust
 use doe::*;
let v1: Vec<f64> = vec_element_convert!(vec![1, 2], f64);
let v2: Vec<i32> = vec_element_convert!(vec![1.0, 2.0], i32);
let v3: Vec<i128> = vec_element_convert!(vec![1.0, 2.0], i128);
let v4: Vec<i32> = vec_element_convert!(vec![1_usize, 2_usize], i32);
let v5: Vec<i64> = vec_element_convert!(vec![0.15, 2.0], i64);
assert_eq!(v1, vec![1.0, 2.0]);
assert_eq!(v2, vec![1, 2]);
assert_eq!(v3, vec![1, 2]);
assert_eq!(v4, vec![1, 2]);
assert_eq!(v5, vec![0, 2]);
 ```
## expr return max value

 ```rust
 use doe::*;
let re_max = max!(1, 20);
assert_eq!(re_max,20);
 ```
## expr return min value

 ```rust
 use doe::*;
let re_min = min!(10, 2, 2, 5, 4, 6);
assert_eq!(re_min,2);
 ```
## convert binary string to decimal

 ```rust
 use doe::*;
let d1 = binary_to_decimal!("01101",i128);
assert_eq!(d1,13_i128);
let d2 = binary_to_decimal!("00000000000010100110001",i64);
assert_eq!(d2,1329_i64);
let d3 = binary_to_decimal!("000011",i32);
assert_eq!(d3,3_i32);
let d4 = binary_to_decimal!("000101",i16);
assert_eq!(d4,5_i16);
let d5 = binary_to_decimal!("001001",i8);
assert_eq!(d5,9_i8);
 ```
## expr return memory address

 ```rust
 use doe::*;
let d1 = binary_to_decimal!("01101",i128);
println!("{:?}",memory_address!(d1));//0x7ffcac734f08
 ```
## Merge two Vec return merged Vec

 ```rust
 use doe::*;
let v1 = vec_merge!(vec![0, 1, 2], vec![5, 6, 7]);
assert_eq!(vec![0, 1, 2, 5, 6, 7],v1);
let v2 = vec_merge!(vec![0., 1., 2.], vec![5., 6., 7.]);
assert_eq!(vec![0., 1., 2., 5., 6., 7.],v2);
```
## take size of elements and return a new vec

 ```rust
 use doe::*;
let v1 = vec_element_take!(vec![0, 1, 2],2);
assert_eq!(vec![0,1],v1);
```
## zip two vec elements in tuple

 ```rust
 use doe::*;
let v1 = vec_zip!(vec![0, 1, 2],vec![0, 1, 2]);
assert_eq!(vec![(0,0),(1,1),(2,2)],v1);
```
## enumerate all indexs and elements collect tuple of vec

 ```rust
 use doe::*;
let v1 = vec_enumerate!(vec![12, 11, 20]);
assert_eq!(vec![(0,12),(1,11),(2,20)],v1);
```
## sort vec and return sorted vec

 ```rust
 use doe::*;
let v1 = vec_sort!(vec![10, 2, 3]);
assert_eq!(vec![2,3,10],v1);
let v2 = vec_sort!(vec![1.8, 2.5, 0.3]);
assert_eq!(vec![0.3,1.8,2.5],v2);
```
## has stable rust nightly return bool

 ```rust
 use doe::*;
 let v1 = has_nightly_compiler!();
 assert_eq!(v1, true);
```
## has stable rust compiler return bool

 ```rust
 use doe::*;
 let v1 = has_stable_compiler!();
 assert_eq!(v1, false);
```
## run command

 ```rust
 use doe::*;
command!("ls -la");
command!("dust");
command!("lsd");
```
## run a function once after a particularized delay(millis)

 ```rust
 use doe::*;
set_timeout!(||{
    println!("ok");
},3000);
```
## run a function after a particularized delay(millis) each run delay(millis)

 ```rust
 use doe::*;
duration_set_timeout!(||{
     println!("ok");
 },3000,1000); //from now delay 3000ms,each 1000ms run func()
```
## run a function repeatedly, beginning after some millis, then repeating continuously at the given interval.

 ```rust
 use doe::*;
set_interval!(||{
    println!("ok");
},3000);
```

## get current UTC-timestamp

 ```rust
 use doe::*;
 let t = utc_timestamp!();
 eprintln!("{}", t);
 ```
## get Local now

 ```rust
 use doe::*;
 let t = local_now!();
 eprintln!("{}", t);
 ```
## get Utc now

 ```rust
 use doe::*;
 let t = utc_now!();
 eprintln!("{}", t);
 ```
## macro for HashMap

```rust
 use doe::*;
 use std::collections::HashMap;
 let mut map:HashMap<i32,i32> = hashmap!();
 map.insert(0, 1);
 let map1 = hashmap!(2=>5,3=>4);
```
## macro for BTreeMap

```rust
 use doe::*;
 use std::collections::BTreeMap;
 let mut map:BTreeMap<i32,i32> = btreemap!();
 map.insert(0, 1);
 let map1 = btreemap!(2=>5,3=>4);
```