Trait selectors::visitor::Visit

source ·
pub trait Visit {
    type Impl: SelectorImpl;

    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§

The type parameter of selector component types.

Required Methods§

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

Implementors§