This commit is contained in:
Simon Gardling 2022-03-24 14:21:42 -04:00
parent 5c8d7d4292
commit 442c3b403c

View File

@ -242,8 +242,11 @@ fn newtons_method(
/// Inputs `Vec<Option<T>>` and outputs a `String` containing a pretty /// Inputs `Vec<Option<T>>` and outputs a `String` containing a pretty
/// representation of the Vector /// representation of the Vector
pub fn option_vec_printer<T: ToString>(data: Vec<Option<T>>) -> String { pub fn option_vec_printer<T: ToString>(data: Vec<Option<T>>) -> String
let none_representation = "None"; where
T: ToString,
T: Clone,
{
let max_i: i32 = (data.len() as i32) - 1; let max_i: i32 = (data.len() as i32) - 1;
let output: String = data let output: String = data
.iter() .iter()
@ -251,7 +254,7 @@ pub fn option_vec_printer<T: ToString>(data: Vec<Option<T>>) -> String {
.map(|(i, x)| { .map(|(i, x)| {
let mut tmp = match x { let mut tmp = match x {
Some(inner) => inner.to_string(), Some(inner) => inner.to_string(),
_ => none_representation.to_string(), _ => "None".to_string(),
}; };
// Add comma and space if needed // Add comma and space if needed