Message uses serde_json::Value for params rather than a typed method enum. This means consumers do a two-step parse: match on the method string,
then serde_json::from_value into the concrete type. A typed enum like:
enum Method {
Notify(Notify),
SetDifficulty(SetDifficulty),
Submit(Submit),
// ...
}
would be more ergonomic on the consumer side. The tradeoff is flexibility — Value lets you pass through methods you don't recognize, which
matters for a proxy. Your current approach is pragmatic and arguably the right call for this use case, but it does push parsing responsibility
onto every consumer.
Message uses serde_json::Value for params rather than a typed method enum. This means consumers do a two-step parse: match on the method string,
then serde_json::from_value into the concrete type. A typed enum like:
enum Method {
Notify(Notify),
SetDifficulty(SetDifficulty),
Submit(Submit),
// ...
}
would be more ergonomic on the consumer side. The tradeoff is flexibility — Value lets you pass through methods you don't recognize, which
matters for a proxy. Your current approach is pragmatic and arguably the right call for this use case, but it does push parsing responsibility
onto every consumer.