Add simple Trigger trait for generating events#29
Open
alexandruag wants to merge 1 commit intorust-vmm:mainfrom
Open
Add simple Trigger trait for generating events#29alexandruag wants to merge 1 commit intorust-vmm:mainfrom
alexandruag wants to merge 1 commit intorust-vmm:mainfrom
Conversation
alxiord
reviewed
Sep 24, 2020
| @@ -0,0 +1,10 @@ | |||
| use std::result::Result; | |||
This is a simple interface which models an object that can generate a single event. Each attempt to trigger the event may return an error, which is defined by an associated type. Signed-off-by: Alexandru Agache <aagch@amazon.com>
17e0796 to
720322d
Compare
alxiord
approved these changes
Sep 24, 2020
Member
|
LGTM. This is the right step towards abstracting away the hypervisor from the emulation layer as well (i.e. looks like what we would need to fix: rust-vmm/vm-superio#7). |
Merged
| /// Abstraction for a simple, push-button like interrupt mechanism. | ||
| pub trait Trigger { | ||
| /// Underlying type for the potential error conditions returned by `Self::trigger`. | ||
| type E; |
There was a problem hiding this comment.
It would be better and more typical to use Error for the generic error type (this is used https://doc.rust-lang.org/std/convert/trait.TryFrom.html for instance).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces the simple
Triggertrait. I've started looking at the pending interrupt proposals and it seems this is a fundamental piece of functionality that we want to include anyway. Also, it can already help with abstracting away things such as usingEventFds to generate events/interrupts forvm-superiodevices.