pub(crate) struct IterState {
state: State,
html: bool,
check_duplicates: bool,
keys: Vec<Range<usize>>,
}
Expand description
External iterator over spans of attribute key and value
Fields§
§state: State
Iteration state that determines what actions should be done before the actual parsing of the next attribute
html: bool
If true
, enables ability to parse unquoted values and key-only (empty)
attributes
check_duplicates: bool
If true
, checks for duplicate names
keys: Vec<Range<usize>>
If check_duplicates
is set, contains the ranges of already parsed attribute
names. We store a ranges instead of slices to able to report a previous
attribute position
Implementations§
source§impl IterState
impl IterState
pub const fn new(offset: usize, html: bool) -> Self
sourcefn recover(&self, slice: &[u8]) -> Option<usize>
fn recover(&self, slice: &[u8]) -> Option<usize>
Recover from an error that could have been made on a previous step.
Returns an offset from which parsing should continue.
If there no input left, returns None
.
sourcefn skip_value(&self, slice: &[u8], offset: usize) -> Option<usize>
fn skip_value(&self, slice: &[u8], offset: usize) -> Option<usize>
Skip all characters up to first space symbol or end-of-input
sourcefn skip_eq_value(&self, slice: &[u8], offset: usize) -> Option<usize>
fn skip_eq_value(&self, slice: &[u8], offset: usize) -> Option<usize>
Skip all characters up to first space symbol or end-of-input
fn check_for_duplicates( &mut self, slice: &[u8], key: Range<usize>, ) -> Result<Range<usize>, AttrError>
sourcefn key_only(
&mut self,
slice: &[u8],
key: Range<usize>,
offset: usize,
) -> Option<Result<Attr<Range<usize>>, AttrError>>
fn key_only( &mut self, slice: &[u8], key: Range<usize>, offset: usize, ) -> Option<Result<Attr<Range<usize>>, AttrError>>
§Parameters
slice
: content of the tag, used for checking for duplicateskey
: Range of key in slice, if iterator in HTML modeoffset
: Position of error if iterator in XML mode
fn double_q( &mut self, key: Range<usize>, value: Range<usize>, ) -> Option<Result<Attr<Range<usize>>, AttrError>>
fn single_q( &mut self, key: Range<usize>, value: Range<usize>, ) -> Option<Result<Attr<Range<usize>>, AttrError>>
pub fn next( &mut self, slice: &[u8], ) -> Option<Result<Attr<Range<usize>>, AttrError>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IterState
impl RefUnwindSafe for IterState
impl Send for IterState
impl Sync for IterState
impl Unpin for IterState
impl UnwindSafe for IterState
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)