pub fn file_type_number_to_symbol(file_type: &str) -> char {
match file_type {
"040" => 'd', "120" => 'l', "020" => 'c', "060" => 'b', "010" => 'p', "140" => 's', _ => '-', }
}
pub fn symbol_to_file_type_number(symbol_type: char) -> String {
match symbol_type {
'd' => "040", 'l' => "120", 'c' => "020", 'b' => "060", 'p' => "010", 's' => "140", _ => "100", }
.to_string()
}
pub fn digit_to_permission(num: &str) -> String {
match num {
"1" => "--x",
"2" => "-w-",
"3" => "-wx",
"4" => "r--",
"5" => "r-x",
"6" => "rw-",
"7" => "rwx",
_ => "---", }
.to_string()
}
pub fn permission_to_digit(perm: &str) -> String {
match perm {
"--x" => "1",
"-w-" => "2",
"-wx" => "3",
"r--" => "4",
"r-x" => "5",
"rw-" => "6",
"rwx" => "7",
_ => "0", }
.to_string()
}