-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: bsbds <[email protected]>
- Loading branch information
Showing
2 changed files
with
58 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,55 @@ | ||
#![allow(clippy::module_name_repetitions)] | ||
|
||
/// Insert into speculative pool | ||
pub trait SpeculativePool { | ||
/// Entry of the pool | ||
type Entry; | ||
|
||
/// Inserts a command in to the pool | ||
/// | ||
/// Returns `Some(Entry)` if a conflict is detected | ||
fn insert(&mut self, entry: Self::Entry) -> Option<Self::Entry>; | ||
|
||
/// Returns the number of commands in the pool | ||
fn len(&self) -> usize; | ||
|
||
/// Checks if the pool contains some commands that will conflict with all other commands | ||
fn is_empty(&self) -> bool; | ||
|
||
/// Removes a command from the pool | ||
fn remove(&mut self, entry: Self::Entry); | ||
|
||
/// Returns all commands in the pool | ||
fn all(&self) -> Vec<Self::Entry>; | ||
|
||
/// Clears all entries in the pool | ||
fn clear(&mut self); | ||
} | ||
|
||
/// Insert into speculative pool | ||
pub trait UncommittedPool { | ||
/// Entry of the pool | ||
type Entry; | ||
/// Inserts a command in to the pool | ||
/// | ||
/// Returns `true` if a conflict is detected | ||
fn insert(&mut self, entry: Self::Entry) -> bool; | ||
|
||
/// Returns all commands in the pool that conflicts with the given command | ||
fn all_conflict(&self, entry: &Self::Entry) -> Vec<Self::Entry>; | ||
|
||
/// Returns all commands in the pool | ||
fn all(&self) -> Vec<Self::Entry>; | ||
|
||
/// Returns the number of commands in the pool | ||
fn len(&self) -> usize; | ||
|
||
/// Checks if the pool will conflict with all commands | ||
fn is_empty(&self) -> bool; | ||
|
||
/// Removes a command from the pool | ||
fn remove(&mut self, entry: Self::Entry); | ||
|
||
/// Clears all entries in the pool | ||
fn clear(&mut self); | ||
} |
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