diff --git a/rust/test/main.rs b/rust/test/main.rs index 6475d3f..4b336ef 100644 --- a/rust/test/main.rs +++ b/rust/test/main.rs @@ -4,7 +4,7 @@ pub fn encode(inp_string: &'static str) -> String{ let x_converted = tup_convert(x_tuple); let mut encoded_string: String = "".to_string(); for each in x_converted.into_iter() { - encoded_string.push_str(each); + encoded_string.push_str(each.as_str()); } return encoded_string; } @@ -24,12 +24,12 @@ fn tupleize(inp_vec: Vec<&str>) -> Vec<(char, usize)>{ } // Converts tuple into a vector of strings -fn tup_convert(inp_tuple: Vec<(char, usize)>) -> Vec<&'static str>{ - let mut converted: Vec<&'static str> = Vec::new(); +fn tup_convert(inp_tuple: Vec<(char, usize)>) -> Vec{ + let mut converted: Vec = Vec::new(); for i in 0..inp_tuple.len() { - let converted_element: &'static str = inp_tuple[i].1.to_string().as_str() + inp_tuple[i].0.to_string().as_str(); + let converted_element: &str = &(inp_tuple[i].1.to_string().as_str().to_owned() + inp_tuple[i].0.to_string().as_str()); // let converted_element: &'static str = string_converted_element; - converted.push(converted_element); + converted.push(converted_element.to_owned()); } return converted; }