pub fn parse<Impl: GeneralQSSpec>(input: &str) -> Result<Parsed, (usize, CoreError)> {
    let mut automaton = ScanAutomaton::<Impl::Parsing>::new();

    for (idx, bch) in input.bytes().enumerate() {
        automaton.advance(PartialCodePoint::from_utf8_byte(bch))
            .map_err(|err| (idx, err.into()))?;

        if automaton.did_end() {
            return Ok(Parsed {
                //idx+1: idx is the idx of the ending '"' which has a byte len of 1
                quoted_string: &input[0..idx + 1],
                tail: &input[idx + 1..]
            })
        }
    }
    // if we reach heare it's a error as the closing '"' is missing.
    // So .end() will _always_ trigger an error in this position
    match automaton.end() {
        Ok(_) =>
            panic!("[BUG] automaton.did_end() == false but automaton.end() does not trigger error"),
        Err(err) => {
            Err((input.len(), err.into()))
        }
    }
}
/// parse a quoted string starting at the begin of `input` but possible ending earlier
///
/// To check if the whole string is a quoted-string (an nothing more) you have to
/// additional check if `parsed.tail` is empty.
///
/// # Error
///
/// a error and the char index where it was triggered is returned if the input does not start
/// with a valid quoted-string.
///
/// # Example
///
/// ```
/// // use your own Spec
/// use quoted_string::test_utils::TestSpec;
/// use quoted_string::{parse, Parsed};
///
/// let parsed = parse::<TestSpec>("\"list of\"; \"quoted strings\"").unwrap();
/// assert_eq!(parsed, Parsed {
///     quoted_string: "\"list of\"",
///     tail:  "; \"quoted strings\""
/// });
/// ```
///
parse a quoted string starting at the begin of `input` but possible ending earlier
To check if the whole string is a quoted-string (an nothing more) you have to
additional check if `parsed.tail` is empty.
parse a quoted string starting at the begin of ` input ` but possible ending earlier To check if the whole string is a quoted - string ( an nothing more ) you have to additional check if ` parsed . tail ` is empty .
pub fn parse<Impl: GeneralQSSpec>(input: &str) -> Result<Parsed, (usize, CoreError)> {
    let mut automaton = ScanAutomaton::<Impl::Parsing>::new();
    for (idx, bch) in input.bytes().enumerate() {
        automaton.advance(PartialCodePoint::from_utf8_byte(bch))
            .map_err(|err| (idx, err.into()))?;
        if automaton.did_end() {
            return Ok(Parsed {
                //idx+1: idx is the idx of the ending '"' which has a byte len of 1
                quoted_string: &input[0..idx + 1],
                tail: &input[idx + 1..]
            })
        }
    }
    // if we reach heare it's a error as the closing '"' is missing.
    // So .end() will _always_ trigger an error in this position
    match automaton.end() {
        Ok(_) =>
            panic!("[BUG] automaton.did_end() == false but automaton.end() does not trigger error"),
        Err(err) => {
            Err((input.len(), err.into()))
        }
    }
}
pub fn parse < Impl : GeneralQSSpec > ( input : & str ) -> Result < Parsed , ( usize , CoreError ) > { let mut automaton = ScanAutomaton :: < Impl :: Parsing > :: new ( ) ; for ( idx , bch ) in input . bytes ( ) . enumerate ( ) { automaton . advance ( PartialCodePoint :: from_utf8_byte ( bch ) ) . map_err ( | err | ( idx , err . into ( ) ) ) ? ; if automaton . did_end ( ) { return Ok ( Parsed { //idx+1: idx is the idx of the ending '"' which has a byte len of 1 quoted_string : & input [ 0 .. idx + 1 ] , tail : & input [ idx + 1 .. ] } ) } } // if we reach heare it's a error as the closing '"' is missing. // So .end() will _always_ trigger an error in this position match automaton . end ( ) { Ok ( _ ) => panic ! ( " " ) , Err ( err ) => { Err ( ( input . len ( ) , err . into ( ) ) ) } } }
parse a quoted string starting at the begin of `input` but possible ending earlier
To check if the whole string is a quoted-string (an nothing more) you have to
additional check if `parsed.tail` is empty.
parse a quoted string starting at the begin of ` input ` but possible ending earlier To check if the whole string is a quoted - string ( an nothing more ) you have to additional check if ` parsed . tail ` is empty .
input
&str
input
&str
error
a error and the char index where it was triggered is returned if the input does not start
with a valid quoted-string.
a error and the char index where it was triggered is returned if the input does not start with a valid quoted - string .
example


let parsed = parse::("\"list of\"; \"quoted strings\"").unwrap();
assert_eq!(parsed, Parsed {
quoted_string: "\"list of\"",
tail:  "; \"quoted strings\""
});
```
let parsed = parse :: ( " \ " list of \ " ; \ " quoted strings \ " " ) . unwrap () ; assert_eq! ( parsed Parsed { quoted_string : " \ " list of \ " " tail : " ; \ " quoted strings \ " " } ) ; ` ` `