-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move RNG generation into the block runtime.
- Loading branch information
Showing
3 changed files
with
23 additions
and
17 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 |
---|---|---|
@@ -1,14 +1,20 @@ | ||
// This is free and unencumbered software released into the public domain. | ||
|
||
use crate::{ | ||
prelude::{Duration, Instant}, | ||
prelude::{Duration, Instant, Range}, | ||
BlockError, Port, | ||
}; | ||
|
||
pub trait BlockRuntime: Send + Sync { | ||
fn is_alive(&self) -> bool; | ||
|
||
fn sleep_for(&self, duration: Duration) -> Result<(), BlockError>; | ||
|
||
fn sleep_until(&self, instant: Instant) -> Result<(), BlockError>; // TODO | ||
|
||
fn wait_for(&self, port: &dyn Port) -> Result<(), BlockError>; | ||
|
||
fn yield_now(&self) -> Result<(), BlockError>; | ||
|
||
fn random_duration(&self, range: Range<Duration>) -> Duration; | ||
} |
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
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