eugene-babichenko/rust-fsm

[Feature Request] Allow specifying existing input/output types

khionu opened this issue · 3 comments

I'm making a parser that uses rust-fsm to guide the consumption of my token stream. It'd be convenient if I could have my FSM use my TokenType as the input.

A catch is that the input type would have to be an enum without constructors, however a derive should be able to verify that that is the case. Alternatively, simply document that the DSL will assume it is.

So, an example code would be something like:

enum CustomInput {}

state_machine! {
    Machine(InitialState)
}

right?

In that case I would suggest doing something like:

state_machine! {
    input_type(CustomInput)
    Machine(InitialState)
}

Is that what you want?

That would work, yes!

Though, the same for output types would be appreciated. I think it's fine for this crate to simply assume the output types are enums without fields