get_paths_in_dir_and_sub_dirs

Function get_paths_in_dir_and_sub_dirs 

Source
pub fn get_paths_in_dir_and_sub_dirs<T: Debug + Display>(
    arg_string_path: &T,
) -> Result<Vec<String>, String>
Expand description

Returns a vec of string paths inside directory In case of a failure, this returns an error explaining what happened

§Arguments

  • arg_string_path: string-like path

§Examples

let string_path = “test”; let result = match get_paths_in_dir_and_sub_dirs( &string_path ) { Ok( vec_result ) => vec_result, Err( err ) => panic!( “{}”, err ) }; let expected = [ “test/test_b”, “test/test_b/test_c”, “test/test_b/test_c/text_b_c_b.txt”, “test/test_b/test_c/text_b_c_a.txt”, “test/test_a”, “test/test_a/text_a_a.txt”, ].iter().map( | item_str | { item_str.to_string() } ).collect::<Vec>(); assert_eq!( result, expected )