selectors::visitor

Trait Visit

source
pub trait Visit {
    type Impl: SelectorImpl;

    // Required method
    fn visit<V>(&self, visitor: &mut V) -> bool
       where V: SelectorVisitor<Impl = Self::Impl>;
}
Expand description

Enables traversing selector components stored in various types

Required Associated Types§

source

type Impl: SelectorImpl

The type parameter of selector component types.

Required Methods§

source

fn visit<V>(&self, visitor: &mut V) -> bool
where V: SelectorVisitor<Impl = Self::Impl>,

Traverse selector components inside self.

Implementations of this method should call SelectorVisitor methods or other impls of Visit as appropriate based on the fields of Self.

A return value of false indicates terminating the traversal. It should be propagated with an early return. On the contrary, true indicates that all fields of self have been traversed:

if !visitor.visit_simple_selector(&self.some_simple_selector) {
    return false;
}
if !self.some_component.visit(visitor) {
    return false;
}
true

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Impl: SelectorImpl> Visit for Component<Impl>
where Impl::NonTSPseudoClass: Visit<Impl = Impl>,

source§

type Impl = Impl

source§

impl<Impl: SelectorImpl> Visit for Selector<Impl>
where Impl::NonTSPseudoClass: Visit<Impl = Impl>,

source§

type Impl = Impl