Parse `sshd_config` to map. # Arguments `input` - The `sshd_config` text to parse. # Errors This function will return an error if the input fails to parse.
(input: &str)
| 378 | /// |
| 379 | /// This function will return an error if the input fails to parse. |
| 380 | pub fn parse_text_to_map(input: &str) -> Result<Map<String,Value>, SshdConfigError> { |
| 381 | let mut parser = SshdConfigParser::new(); |
| 382 | parser.parse_text(input)?; |
| 383 | let lowercased_map = parser.map.into_iter() |
| 384 | .map(|(k, v)| (k.to_lowercase(), v)) |
| 385 | .collect(); |
| 386 | Ok(lowercased_map) |
| 387 | } |
| 388 | |
| 389 | #[cfg(test)] |
| 390 | mod tests { |