-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add breaking changes to the specification traits
- Loading branch information
Showing
9 changed files
with
147 additions
and
158 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
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
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
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,29 +1,26 @@ | ||
/// The sequential implementation of a data structure. | ||
pub trait SequentialSpec { | ||
pub trait SequentialSpec: Default { | ||
/// The type of operations. | ||
type Op; | ||
|
||
/// The type of return values. | ||
type Ret; | ||
|
||
/// Creates a new instance of the data structure. | ||
fn new() -> Self; | ||
|
||
/// Executes an operation on the data structure. | ||
fn exec(&mut self, op: Self::Op) -> Self::Ret; | ||
} | ||
|
||
/// The concurrent implementation of a data structure. | ||
pub trait ConcurrentSpec { | ||
/// The type of operations. | ||
type Op; | ||
|
||
/// The type of return values. | ||
type Ret; | ||
|
||
/// Creates a new instance of the data structure. | ||
fn new() -> Self; | ||
pub trait ConcurrentSpec: Default { | ||
/// The sequential specification for the data structure. | ||
type Seq: SequentialSpec; | ||
|
||
/// Executes an operation on the data structure. | ||
fn exec(&self, op: Self::Op) -> Self::Ret; | ||
fn exec(&self, op: ConcOp<Self>) -> ConcRet<Self>; | ||
} | ||
|
||
/// Type alias not to have always write down FQP. | ||
pub type ConcOp<T> = <<T as ConcurrentSpec>::Seq as SequentialSpec>::Op; | ||
|
||
/// Type alias not to have always write down FQP. | ||
pub type ConcRet<T> = <<T as ConcurrentSpec>::Seq as SequentialSpec>::Ret; |
Oops, something went wrong.