-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: impl attribute matching #5
base: master
Are you sure you want to change the base?
Conversation
Is it required to add an extra type parameter? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the PR!
But you still need to add some test cases.
c9d2aac
to
002242f
Compare
A type parameter allows embedder making its own attribute memory layout. Actually I also wishes making For example, my embedder setup an Attribute struct with attribute name enumerations to reduce memory footprint. struct Attr {
name: AttrName,
value: TmplNativeData,
}
enum AttrName {
Class,
Name,
EnableFlex,
...
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I think a default implementation is needed for the new type parameter, otherwise it can be weird for clients that does not need attribute matching. |
And also, if you wish to use custom layout for node trees, it should better be done through a custom trait StyleQuery {
type ClassIter: Iterator<Item = (String, Option<NonZeroUsize>)>;
fn tag_name(&self) -> &str;
fn classes(&self) -> Self::ClassIter;
// ...
fn attribute(&self, name: &str) -> &str;
} |
No description provided.