claudiofsr_lib

Function to_vec_string

Source
pub fn to_vec_string<T>(v: &[T]) -> Vec<String>
where T: ToString,
Expand description

Convert Vec<&str> to Vec<String>

https://www.reddit.com/r/learnrust/comments/h82em8/best_way_to_create_a_vecstring_from_str

Example:

    use claudiofsr_lib::to_vec_string;
    let original: Vec<&str> = vec!["this", "that", "the other"];
    let result: Vec<String> = to_vec_string(&original);
    assert_eq!(result, vec![
        String::from("this"),
        String::from("that"),
        String::from("the other"),
    ]);