Crate useful_macro

Source

Modules§

macros

Macros§

args
arg!() can be used to get argument and collect to Vec<String>
as_to
as_to!() can be used to convert type
binary_to_decimal
convert binary string to decimal
command
run command
deduped_sorted
deduped_sorted!() can be used to return sorted and deduped new Vec, type can be Vec<i32> Vec<i64> Vec<i128> Vec<f32> Vec<f64>
has_nightly_compiler
has stable rust nightly return bool
has_stable_compiler
has stable rust compiler return bool
input
input!() can be used to get user input from terminal
max
expr return max value
memory_address
expr return memory address
min
expr return min value
multiply_matrix
multiply_matrix!() return the mutiply result of two matrix take two matrix and type can be Vec<Vec<f64>> return Vec<f64>
powf
powf!(a,b) can be used to a to the power of b
read_csv
read_csv!() can be used to read .csv file and return Vec<Vec<String>>
remove_file_or_folder
remove_file_or_folder!() used to remove file or folder
snail_sort
snail_sort!() return the array elements arranged from outermost elements to the middle element, traveling clockwise.n x n type can be Vec<Vec<T>> return Vec<T>
sorted
sorted!() can be used to return sorted new Vec, type can be Vec<i32> Vec<i64> Vec<i128> Vec<f32> Vec<f64>
split_to_vec
split_to_vec!() can be used to a:&str split by b:&str and collect to Vec<String>
vec_element_clone
vec_element_clone!() used to when occure cannot move out of index of Vec<String> move occurs because value has type String, which does not implement the Copy trait
vec_element_convert
vec_element_convert!() used convert vec elements type
vec_element_parse
vec_element_parse!() can be used to parse a vec element to type need a Vec<&str>,parse type return Vec<type>
vec_element_position_all
vec_element_position_all!() used to find element position and collect into Vec
vec_element_remove
vec_element_remove!() used to find the element fist position and remove if not fond the element return original vec type can be Vec<i32> Vec<i64> Vec<i128> Vec<f32> Vec<f64>,Vec<&str> return return the same type
vec_element_remove_all
vec_element_remove_all!() used to find the element all position and remove if not fond the element return original vec type can be Vec<i32> Vec<i64> Vec<i128> Vec<f32> Vec<f64>,Vec<&str> return return the same type
vec_element_take
take size of elements and return a new vec
vec_element_to_string
vec_element_to_string!() used to convert vec item to String, type can be Vec<i32> Vec<i64> Vec<i128> Vec<f32> Vec<f64>,Vec<&str> return Vec<String>
vec_enumerate
enumerate all indexs and elements collect tuple of vec
vec_merge
merge two vec return merged vec
vec_slice
vec_slice!() used to slice vec by range return return the same type sliced vec
vec_sort
sort vec and return sorted vec
vec_type
vec_type!() used to get vec type return format!(“{}”,type);
vec_zip
zip two vec elements in tuple