Parse an algorithm name from a string. # Accepted Values - "myers" or "Myers" → `Algorithm::Myers` - "patience" or "Patience" → `Algorithm::Patience` # Errors Returns `AlgorithmParseError` if the string doesn't match any known algorithm name.
(s: &str)
| 129 | /// Returns `AlgorithmParseError` if the string doesn't match |
| 130 | /// any known algorithm name. |
| 131 | fn from_str(s: &str) -> Result<Self, Self::Err> { |
| 132 | match s.to_lowercase().as_str() { |
| 133 | "myers" => Ok(Algorithm::Myers), |
| 134 | "patience" => Ok(Algorithm::Patience), |
| 135 | _ => Err(AlgorithmParseError(s.to_string())), |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | /// Error returned when parsing an unknown algorithm name. |
nothing calls this directly
no test coverage detected