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§
sourcetype Impl: SelectorImpl
type Impl: SelectorImpl
The type parameter of selector component types.
Required Methods§
sourcefn visit<V>(&self, visitor: &mut V) -> boolwhere
V: SelectorVisitor<Impl = Self::Impl>,
fn visit<V>(&self, visitor: &mut V) -> boolwhere
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.