-
Notifications
You must be signed in to change notification settings - Fork 100
virtq: use enum_dispatch #1671
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
base: main
Are you sure you want to change the base?
virtq: use enum_dispatch #1671
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.
Thanks! This looks really good :)
@@ -878,7 +879,7 @@ pub(crate) enum VirtioDriver { | |||
))] | |||
Network(VirtioNetDriver), | |||
#[cfg(feature = "vsock")] | |||
Vsock(VirtioVsockDriver), | |||
Vsock(Box<VirtioVsockDriver>), |
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.
Why do we need a Box
here? 🤔
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.
Clippy was complaining about the enum variants having vastly different sizes. I'm not really sure whether we want to box here or not. It's probably very unlikely that all of them are enabled at once...
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.
Ah, sure. In that case, it makes sense. 👍
Closes hermit-os#989 Co-authored-by: Jens Reidel <[email protected]>
063ae46
to
1c0ff9d
Compare
Gets rid of some unneeded dynamic dispatch.
Closes #989
Supersedes #1406 (this is a rebased and slightly fixed up version of that PR)