-
Notifications
You must be signed in to change notification settings - Fork 7
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
More rusty and support shanghai fork #8
base: main
Are you sure you want to change the base?
Conversation
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.
First of all thanks for the contribution and sorry for the late reply.🙏
Good idea to implement tryFrom, however I feel the implementation might be more verbose than it needs to be. What do you think ?
|
||
fn try_from(x: u8) -> Result<Self, Self::Error> { | ||
match x { | ||
x if x == Opcode::STOP as u8 => Ok(Opcode::STOP), |
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.
This seems more verbose than the original mapping. I have a hunch there should be a more concise way to do this . Like using match to check wether the value matches any of the enum values in one line instead of 1 line for each enum variant. what do you think ?
SELFDESTRUCT = 255, | ||
} | ||
|
||
impl TryFrom<u8> for Opcode { |
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.
Generally good idea to implement tryFrom 👍
As title.
TryFrom