musicmatze :rust: :nixos: on Nostr: Ok so here's my current #rust problem. I have an enum, each variant has a struct: ...
Ok so here's my current #rust problem.
I have an enum, each variant has a struct: `enum E { A(A), B(B), ... }`. This is what my tool receives via network. I have `Service` impls, but not for `A` and `B`, but for `A'` and `B'`.
The enum variant types can be mapped into what the services receive.
The response type of each service can also be mapped into a response enum variant (same thing like above, but reverse).
How do I build a generic router for this?
#rust #rustlang
Published at
2026-01-27 20:21:56 UTCEvent JSON
{
"id": "0ebaf32fe2f78b5db267f097ed52c43e76cc1b179de6e9aa31c1dca8b7f05bc5",
"pubkey": "9774fa73d93e8079d02b61097a0aae23f9890f35ef99040aec95d0def2f24e27",
"created_at": 1769545316,
"kind": 1,
"tags": [
[
"t",
"rust"
],
[
"t",
"rustlang"
],
[
"proxy",
"https://social.linux.pizza/users/musicmatze/statuses/115968921834754701",
"activitypub"
],
[
"client",
"Mostr",
"31990:6be38f8c63df7dbf84db7ec4a6e6fbbd8d19dca3b980efad18585c46f04b26f9:mostr",
"wss://relay.ditto.pub"
]
],
"content": "Ok so here's my current #rust problem.\n\nI have an enum, each variant has a struct: `enum E { A(A), B(B), ... }`. This is what my tool receives via network. I have `Service` impls, but not for `A` and `B`, but for `A'` and `B'`.\n\nThe enum variant types can be mapped into what the services receive.\n\nThe response type of each service can also be mapped into a response enum variant (same thing like above, but reverse).\n\nHow do I build a generic router for this?\n\n#rust #rustlang",
"sig": "978d5a5e136ee7f755d432b43176679ae3653e4a87027355ce2c94521c078f3144f59519f47c6987b01e3e03939141c40d21c5354abe1878fc0fe4ddeae6e66b"
}