Trait quoted_string::spec::WithoutQuotingValidator[][src]

pub trait WithoutQuotingValidator {
    fn next(&mut self, pcp: PartialCodePoint) -> bool;

    fn end(&self) -> bool { ... }
}

Used to validate if a string is valid without beeing quoted.

Depending on the complexity of the underlying grammar this types implementing this trait might have an internal state, through they have to be careful wrt. the semantics of next when mutating it.

Types impl this trait are normally not expected to be reused between multiple calls to quoted_if_needed (or whoever uses it). And might keep track of some meta-information as they are passed normally to the consuming function as &mut.

Required Methods

if next returns false, it's (self) state should NOT be modified i.e. calling .end() after next(..) and returning false corresponds to the input sequence until next(..) was false, not including the pcp from the last next call

Provided Methods

this is called once the validation through next ended

  • the validation might end because there is no more input
  • but it also might end because next returned false, due to the definition of next to not change the state if it returns false this can and is done
  • it does not need to validate that the length is at last 1, this is done by the algorithm using it
  • so for many cases this is just true (the default impl)

Implementors