mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-03 08:24:19 +01:00
Merge 'state_machine: remove State associated type' from Pere Diaz Bou
Reviewed-by: Preston Thorpe <preston@turso.tech> Closes #2395
This commit is contained in:
@@ -305,7 +305,6 @@ impl WriteRowStateMachine {
|
||||
}
|
||||
|
||||
impl<Clock: LogicalClock> StateTransition for CommitStateMachine<Clock> {
|
||||
type State = CommitStateMachine<Clock>;
|
||||
type Context = MvStore<Clock>;
|
||||
type SMResult = ();
|
||||
|
||||
@@ -590,7 +589,6 @@ impl<Clock: LogicalClock> StateTransition for CommitStateMachine<Clock> {
|
||||
}
|
||||
|
||||
impl StateTransition for WriteRowStateMachine {
|
||||
type State = WriteRowStateMachine;
|
||||
type Context = ();
|
||||
type SMResult = ();
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ pub enum TransitionResult<Result> {
|
||||
|
||||
/// A generic trait for state machines.
|
||||
pub trait StateTransition {
|
||||
type State;
|
||||
type Context;
|
||||
type SMResult;
|
||||
|
||||
@@ -44,11 +43,10 @@ impl<State: StateTransition> StateMachine<State> {
|
||||
}
|
||||
|
||||
impl<State: StateTransition> StateTransition for StateMachine<State> {
|
||||
type State = State;
|
||||
type Context = State::Context;
|
||||
type SMResult = State::SMResult;
|
||||
|
||||
fn step(&mut self, context: &Self::Context) -> Result<TransitionResult<Self::SMResult>> {
|
||||
fn step<'a>(&mut self, context: &Self::Context) -> Result<TransitionResult<Self::SMResult>> {
|
||||
loop {
|
||||
if self.is_finalized {
|
||||
unreachable!("StateMachine::transition: state machine is finalized");
|
||||
|
||||
Reference in New Issue
Block a user