-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
1 parent
e60409e
commit 17e0796
Showing
2 changed files
with
11 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use std::result::Result; | ||
|
||
/// 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; | ||
|
||
/// Trigger an event. | ||
fn trigger(&self) -> Result<(), Self::E>; | ||
} |
This file contains 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