parcel-bundler / parcel-bundler/lightningcss
[question] How to use a SelectorVisitor from a Visitor
Open
Nobody has claimed this yet.
pending triage
- Dominant language
- Rust
- Stars
- 7.7k
- Forks
- 302
- PR merge metrics
- No merged PRs in 30d
Description
I'm using a Visitor to visit selectors. When I find one, I then want to use a SelectorVisitor to inspect the Selector further. I have no idea what I can provide as a suitable Impl type in the SelectorVisitor.
impl<'a> Visitor<'a> for Foo {
type Error = ...;
fn visit_types(&self) -> VisitTypes {
visit_types!(SELECTORS)
}
fn visit_selector(&mut self, selector: &mut Selector<'a>) -> Result<(), Self::Error> {
// Would like to know what to put in place of ??? here:
selector.visit(???);
}
}
and / or here:
impl<'a> SelectorVisitor<'a> for Foo {
type Impl = ???;
...
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Visitor, SelectorVisitor, and Selector::visit definitions to understand how the Impl type is chosen and how nested selector traversal is intended to work. Check existing implementations for a suitable pattern, then document the required usage or clarify the API so this example has an unambiguous answer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100