KernelKind on Nostr: u would have to do value.0 to access the first element and value.1 to access the ...
u would have to do value.0 to access the first element and value.1 to access the second element. that doesn’t really tell you anything. much better would be:
struct KeyWithPayload<'a> {
key: u8,
payload: &'a [u8],
}
value: KeyWithPayload
now you can do value.key to know you’re accessing the “key” and value.payload to access the “payload”. much easier to work with as a human dev
Published at
2024-11-05 18:25:05Event JSON
{
"id": "2444dfb0dcb192caa2b7a57bc2422bc6f5fb10dff0a8b46a057bb25b0c6ff7d9",
"pubkey": "4a0510f26880d40e432f4865cb5714d9d3c200ca6ebb16b418ae6c555f574967",
"created_at": 1730831105,
"kind": 1,
"tags": [
[
"e",
"000005bb89aa5adc41cfcd05a0f34a14e32d62b102a7509fa97ca59a3e6173bf",
"",
"root"
],
[
"e",
"c64555106eac1afa1450ccb3c75fc5b88f98a86dc1dd1a9ea60812789ed960d7",
"",
"reply"
],
[
"p",
"d3d74124ddfb5bdc61b8f18d17c3335bbb4f8c71182a35ee27314a49a4eb7b1d"
]
],
"content": "u would have to do value.0 to access the first element and value.1 to access the second element. that doesn’t really tell you anything. much better would be:\n\nstruct KeyWithPayload\u003c'a\u003e {\n key: u8,\n payload: \u0026'a [u8],\n}\n\nvalue: KeyWithPayload\n\nnow you can do value.key to know you’re accessing the “key” and value.payload to access the “payload”. much easier to work with as a human dev",
"sig": "af98340d0f495007470c166d79d3707d95e06f00bc6b4b3ca670575553cf849d54158102118ac6c3dc6efacd21cbbc9a764280c9f3380a394250af446c6f1c2d"
}