pub trait SelectorVisitor: Sized {
type Impl: SelectorImpl;
// Provided methods
fn visit_attribute_selector(
&mut self,
_namespace: &NamespaceConstraint<&<Self::Impl as SelectorImpl>::NamespaceUrl>,
_local_name: &<Self::Impl as SelectorImpl>::LocalName,
_local_name_lower: &<Self::Impl as SelectorImpl>::LocalName,
) -> bool { ... }
fn visit_simple_selector(&mut self, _: &Component<Self::Impl>) -> bool { ... }
fn visit_relative_selector_list(
&mut self,
_list: &[RelativeSelector<Self::Impl>],
) -> bool { ... }
fn visit_selector_list(
&mut self,
_list_kind: SelectorListKind,
list: &[Selector<Self::Impl>],
) -> bool { ... }
fn visit_complex_selector(
&mut self,
_combinator_to_right: Option<Combinator>,
) -> bool { ... }
}
Expand description
A trait to visit selector properties.
All the visit_foo
methods return a boolean indicating whether the
traversal should continue or not.
Required Associated Types§
Sourcetype Impl: SelectorImpl
type Impl: SelectorImpl
The selector implementation this visitor wants to visit.
Provided Methods§
Sourcefn visit_attribute_selector(
&mut self,
_namespace: &NamespaceConstraint<&<Self::Impl as SelectorImpl>::NamespaceUrl>,
_local_name: &<Self::Impl as SelectorImpl>::LocalName,
_local_name_lower: &<Self::Impl as SelectorImpl>::LocalName,
) -> bool
fn visit_attribute_selector( &mut self, _namespace: &NamespaceConstraint<&<Self::Impl as SelectorImpl>::NamespaceUrl>, _local_name: &<Self::Impl as SelectorImpl>::LocalName, _local_name_lower: &<Self::Impl as SelectorImpl>::LocalName, ) -> bool
Visit an attribute selector that may match (there are other selectors that may never match, like those containing whitespace or the empty string).
Sourcefn visit_simple_selector(&mut self, _: &Component<Self::Impl>) -> bool
fn visit_simple_selector(&mut self, _: &Component<Self::Impl>) -> bool
Visit a simple selector.
Sourcefn visit_relative_selector_list(
&mut self,
_list: &[RelativeSelector<Self::Impl>],
) -> bool
fn visit_relative_selector_list( &mut self, _list: &[RelativeSelector<Self::Impl>], ) -> bool
Visit a nested relative selector list. The caller is responsible to call visit into the internal selectors if / as needed.
The default implementation skips it altogether.
Sourcefn visit_selector_list(
&mut self,
_list_kind: SelectorListKind,
list: &[Selector<Self::Impl>],
) -> bool
fn visit_selector_list( &mut self, _list_kind: SelectorListKind, list: &[Selector<Self::Impl>], ) -> bool
Visit a nested selector list. The caller is responsible to call visit into the internal selectors if / as needed.
The default implementation does this.
Sourcefn visit_complex_selector(
&mut self,
_combinator_to_right: Option<Combinator>,
) -> bool
fn visit_complex_selector( &mut self, _combinator_to_right: Option<Combinator>, ) -> bool
Visits a complex selector.
Gets the combinator to the right of the selector, or None
if the
selector is the rightmost one.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.