Stratum crate: add Method enum #558

Open
opened 2026-05-27 14:04:47 +00:00 by paratoxic · 0 comments
Owner

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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
parasitepool/para#558
No description provided.