[][src]Struct cssparser::DeclarationListParser

pub struct DeclarationListParser<'i, 't, 'a, P> {
    pub input: &'a mut Parser<'i, 't>,
    pub parser: P,
}

Provides an iterator for declaration list parsing.

Fields

input: &'a mut Parser<'i, 't>

The input given to DeclarationListParser::new

parser: P

The parser given to DeclarationListParser::new

Implementations

impl<'i, 't, 'a, I, P, E: 'i> DeclarationListParser<'i, 't, 'a, P> where
    P: DeclarationParser<'i, Declaration = I, Error = E> + AtRuleParser<'i, AtRule = I, Error = E>, 
[src]

pub fn new(input: &'a mut Parser<'i, 't>, parser: P) -> Self[src]

Create a new DeclarationListParser for the given input and parser.

Note that all CSS declaration lists can on principle contain at-rules. Even if no such valid at-rule exists (yet), this affects error handling: at-rules end at {} blocks, not just semicolons.

The given parser therefore needs to implement both DeclarationParser and AtRuleParser traits. However, the latter can be an empty impl since AtRuleParser provides default implementations of its methods.

The return type for finished declarations and at-rules also needs to be the same, since <DeclarationListParser as Iterator>::next can return either. It could be a custom enum.

Trait Implementations

impl<'i, 't, 'a, I, P, E: 'i> Iterator for DeclarationListParser<'i, 't, 'a, P> where
    P: DeclarationParser<'i, Declaration = I, Error = E> + AtRuleParser<'i, AtRule = I, Error = E>, 
[src]

DeclarationListParser is an iterator that yields Ok(_) for a valid declaration or at-rule or Err(()) for an invalid one.

type Item = Result<I, (ParseError<'i, E>, &'i str)>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'i, 't, 'a, P> !RefUnwindSafe for DeclarationListParser<'i, 't, 'a, P>[src]

impl<'i, 't, 'a, P> !Send for DeclarationListParser<'i, 't, 'a, P>[src]

impl<'i, 't, 'a, P> !Sync for DeclarationListParser<'i, 't, 'a, P>[src]

impl<'i, 't, 'a, P> Unpin for DeclarationListParser<'i, 't, 'a, P> where
    P: Unpin,
    'i: 'a,
    't: 'a, 
[src]

impl<'i, 't, 'a, P> !UnwindSafe for DeclarationListParser<'i, 't, 'a, P>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.