MCPcopy Create free account
hub / github.com/PowerShell/DSC / parse_text_to_map

Function parse_text_to_map

resources/sshdconfig/src/parser.rs:380–387  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

378///
379/// This function will return an error if the input fails to parse.
380pub 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)]
390mod tests {

Calls 3

parse_textMethod · 0.80
into_iterMethod · 0.80
newFunction · 0.50