fn key_value(s: &str) -> Result<(&str, &str), ParsingError> {
    let colon = s.find(':').ok_or(ParsingError::Other("not a proper key-value pair (no colon present)"))?;
    // Check out-of-bounds to avoid panic.
    if colon + 1 < s.len() {
        Ok((s[..colon].trim_end(), s[colon + 1..].trim_start()))
    } else {
        Err(ParsingError::Other("no value specified"))
    }
}
/// Parse a key-value pair in the format `<key>: <value>`.
///
/// The colon may be surronded by whitespaces, which will be trimmed. However, the start and end of
/// `s` is not trimmed.
Parse a key-value pair in the format `: `.
The colon may be surronded by whitespaces, which will be trimmed. However, the start and end of
`s` is not trimmed.
Parse a key - value pair in the format ` : ` . The colon may be surronded by whitespaces which will be trimmed . However the start and end of ` s ` is not trimmed .
fn key_value(s: &str) -> Result<(&str, &str), ParsingError> {
    let colon = s.find(':').ok_or(ParsingError::Other("not a proper key-value pair (no colon present)"))?;
    // Check out-of-bounds to avoid panic.
    if colon + 1 < s.len() {
        Ok((s[..colon].trim_end(), s[colon + 1..].trim_start()))
    } else {
        Err(ParsingError::Other("no value specified"))
    }
}
fn key_value ( s : & str ) -> Result < ( & str , & str ) , ParsingError > { let colon = s . find ( ':' ) . ok_or ( ParsingError :: Other ( " " ) ) ? ; // Check out-of-bounds to avoid panic. if colon + 1 < s . len ( ) { Ok ( ( s [ .. colon ] . trim_end ( ) , s [ colon + 1 .. ] . trim_start ( ) ) ) } else { Err ( ParsingError :: Other ( " " ) ) } }
Parse a key-value pair in the format `<key>: <value>`.
Parse a key - value pair in the format ` <key > : <value > ` .
s
&str
s
&str