quick_xml::events::attributes

Struct IterState

source
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

source

pub const fn new(offset: usize, html: bool) -> Self

source

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.

source

fn skip_value(&self, slice: &[u8], offset: usize) -> Option<usize>

Skip all characters up to first space symbol or end-of-input

source

fn skip_eq_value(&self, slice: &[u8], offset: usize) -> Option<usize>

Skip all characters up to first space symbol or end-of-input

source

fn check_for_duplicates( &mut self, slice: &[u8], key: Range<usize>, ) -> Result<Range<usize>, AttrError>

source

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 duplicates
  • key: Range of key in slice, if iterator in HTML mode
  • offset: Position of error if iterator in XML mode
source

fn double_q( &mut self, key: Range<usize>, value: Range<usize>, ) -> Option<Result<Attr<Range<usize>>, AttrError>>

source

fn single_q( &mut self, key: Range<usize>, value: Range<usize>, ) -> Option<Result<Attr<Range<usize>>, AttrError>>

source

pub fn next( &mut self, slice: &[u8], ) -> Option<Result<Attr<Range<usize>>, AttrError>>

Trait Implementations§

source§

impl Clone for IterState

source§

fn clone(&self) -> IterState

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for IterState

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.