Crate e_utils

source ·
Expand description

E-UTILS

§Random 工具宏

§Exmaple Nanoid

fn main() {
    use e_utils::algorithm;
    println!("nanoid -> {}", algorithm!(nanoid));
    println!("nanoid 16bytes -> {}", algorithm!(nanoid 16));
    println!("nanoid 16bytes -> {}", algorithm!(nanoid 16));
    println!("nanoid 10bytes [alphabet:expr] -> {}", algorithm!(nanoid 16, &['1', 'b', 'c', '7']));
    println!("nanoid unsafe 10bytes -> {}", algorithm!(nanoid unsafe 10));
    println!("nanoid unsafe 10bytes [alphabet:expr]-> {}", algorithm!(nanoid unsafe 10, &['1','0']));
}

§Exmaple random

fn main() {
   use e_utils::algorithm;
   println!("random bool -> {}", algorithm!());
   println!("random type -> {}", algorithm!(#u32));
   println!("random type[] -> {:?}", algorithm!([u32; 10]));
   println!("random range 0-13 -> {}", algorithm!(13));
   println!("random range -> {}", algorithm!(0i32..13));
   println!("random rgb range -> {:?}", algorithm!(rgb 100,255));
}

Re-exports§

  • pub use res::*;

Modules§

Macros§

Derive Macros§

  • 对C语言的增加处理方法
  • 对象克隆