mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
2df3f490dd
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
37 lines
647 B
Rust
37 lines
647 B
Rust
// check-pass
|
|
|
|
#![allow(unreachable_code, unused)]
|
|
|
|
use std::marker::PhantomData;
|
|
|
|
struct FsmBuilder<TFsm> {
|
|
_fsm: PhantomData<TFsm>,
|
|
}
|
|
|
|
impl<TFsm> FsmBuilder<TFsm> {
|
|
fn state(&mut self) -> FsmStateBuilder<TFsm> {
|
|
todo!()
|
|
}
|
|
}
|
|
|
|
struct FsmStateBuilder<TFsm> {
|
|
_state: PhantomData<TFsm>,
|
|
}
|
|
|
|
impl<TFsm> FsmStateBuilder<TFsm> {
|
|
fn on_entry<TAction: Fn(&mut StateContext<'_, TFsm>)>(&self, _action: TAction) {}
|
|
}
|
|
|
|
trait Fsm {
|
|
type Context;
|
|
}
|
|
|
|
struct StateContext<'a, TFsm: Fsm> {
|
|
context: &'a mut TFsm::Context,
|
|
}
|
|
|
|
fn main() {
|
|
let mut builder: FsmBuilder<usize> = todo!();
|
|
builder.state().on_entry(|_| {});
|
|
}
|