-
Notifications
You must be signed in to change notification settings - Fork 62
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: split Chain into a struct and ChainKind enum #5
Conversation
f36dd50
to
1984db9
Compare
1984db9
to
9bd6c61
Compare
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.
I like this
pending @Evalir
] | ||
} | ||
} | ||
|
||
impl Chain { |
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.
can we move this below the struct def?
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.
I prefer trait impls blocks before main impl, that's how I did it in all of core
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.
I'm used to above trait impls -.-
but I don't mind
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.
Super nice. I like implemeting traits first too, so agree
By making the fields private, we also make room for potential optimizations in the future, such as reducing the size of Chain from 16 to 8 bytes.
ahhh we're optimizingg
Instead of checking whether
Self::Id(_)
can be converted into aNamedChain
everywhere, we can enforce this at construction by makingChain
a struct with a hidden innerChainKind
enum.By making the fields private, we also make room for potential optimizations in the future, such as reducing the size of
Chain
from 16 to 8 bytes.