pub(crate) fn try_consume_str(s: &mut &str, expected: &str) -> ParseResult<()> {
    if s.starts_with(expected) {
        *s = &s[expected.len()..];
        Ok(())
    } else {
        // Iterate through the characters, returning the error where differing.
        for c in expected.chars() {
            try_consume_char(s, c)?;
        }
        // TODO Find a way to allow the compiler to prove the following is not
        // necessary.
        unreachable!("The previous loop should always cause the function to return.");
    }
}
/// Attempt to consume the provided string.
Attempt to consume the provided string.
Attempt to consume the provided string .
pub(crate) fn try_consume_str(s: &mut &str, expected: &str) -> ParseResult<()> {
    if s.starts_with(expected) {
        *s = &s[expected.len()..];
        Ok(())
    } else {
        // Iterate through the characters, returning the error where differing.
        for c in expected.chars() {
            try_consume_char(s, c)?;
        }
        // TODO Find a way to allow the compiler to prove the following is not
        // necessary.
        unreachable!("The previous loop should always cause the function to return.");
    }
}
pub ( crate ) fn try_consume_str ( s : & mut & str , expected : & str ) -> ParseResult < ( ) > { if s . starts_with ( expected ) { * s = & s [ expected . len ( ) .. ] ; Ok ( ( ) ) } else { // Iterate through the characters, returning the error where differing. for c in expected . chars ( ) { try_consume_char ( s , c ) ? ; } // TODO Find a way to allow the compiler to prove the following is not // necessary. unreachable ! ( " " ) ; } }
Attempt to consume the provided string.
Attempt to consume the provided string .
s
&mut &str
expected
&str
s
&mut &str
expected
&str