Macro doe::vec_element_remove
source · [−]macro_rules! vec_element_remove {
($vec:expr,$element:expr) => { ... };
}Expand description
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
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);