get_relative_path

Function get_relative_path 

Source
pub fn get_relative_path<T1: Debug + Display, T2: Debug + Display>(
    arg_string_path: &T1,
    arg_string_path_root_prefix: &T2,
) -> Result<String, String>
Expand description

Returns a string that’s a relative path after the prefix is removed In case of a failure, this returns an error explaining what happened

§Arguments

  • arg_string_path: string-like path

§Examples

let string_relative_path = match get_relative_path( &“/A/B/C/D”, &“/A/B” ) { Ok( string_result ) => { string_result } Err( err ) => { panic!( “{}”, err, ) } }; // string_relative_path = “C/D”