pub fn splitarg(s: &str) -> Result<(&str, &str), SplitArgError> {
    if !is_balanced(s) {
        return Err(SplitArgError::NotAnEnum);
    }
    match s.find('{') {
        Some(i) => {
            if i > 0 && s.ends_with('}') {
                Ok((&s[..i], unprotect(&s[i..])))
            } else {
                Err(SplitArgError::NotAnEnum)
            }
        }
        None => Ok((s, "")),
    }
}
/// Splits key from optional, unconditionally protected value.
///
/// Inverse of `key + protect_unconditionally(value)` or `key`, where `key` is
/// a string without curly braces. Returns `key` and `value`.
///
/// # Errors
///
/// Returns `Err` only if `s` contains a `'{'` but does not end with `'}'`. The
/// behavior of other invalid inputs is undefined.
Splits key from optional, unconditionally protected value.
Splits key from optional unconditionally protected value .
pub fn splitarg(s: &str) -> Result<(&str, &str), SplitArgError> {
    if !is_balanced(s) {
        return Err(SplitArgError::NotAnEnum);
    }
    match s.find('{') {
        Some(i) => {
            if i > 0 && s.ends_with('}') {
                Ok((&s[..i], unprotect(&s[i..])))
            } else {
                Err(SplitArgError::NotAnEnum)
            }
        }
        None => Ok((s, "")),
    }
}
pub fn splitarg ( s : & str ) -> Result < ( & str , & str ) , SplitArgError > { if ! is_balanced ( s ) { return Err ( SplitArgError :: NotAnEnum ) ; } match s . find ( '{' ) { Some ( i ) => { if i > 0 && s . ends_with ( '}' ) { Ok ( ( & s [ .. i ] , unprotect ( & s [ i .. ] ) ) ) } else { Err ( SplitArgError :: NotAnEnum ) } } None => Ok ( ( s , " " ) ) , } }
Splits key from optional, unconditionally protected value.
Splits key from optional unconditionally protected value .
s
&str
s
&str
errors
Returns `Err` only if `s` contains a `'{'` but does not end with `'}'`. The
behavior of other invalid inputs is undefined.
Returns ` Err ` only if ` s ` contains a ` ' { ' ` but does not end with ` ' } ' ` . The behavior of other invalid inputs is undefined .