Michael A. Murphy :system76: on Nostr: npub13w6fh…l479m Yes, and there are multiple ways to achieve this. Using only the ...
npub13w6fhssk27ffmh00g8lfr9p8adxcrvtf8lgu6z2j6je7ugmtqpws4l479m (npub13w6…479m) Yes, and there are multiple ways to achieve this. Using only the standard library, you can use a Rc'd RefCell, which requires a runtime borrow check on each access.
With the qcell crate, you can use Rc'd QCell/TCell/LCell, based on GhostCell, to achieve the same affect with compile-time borrow checks.
Or you could use generational indices like in the doubly-linked list example for the slotmap crate.
There's also some graph crates like petgraph.
Published at
2023-06-28 14:43:11Event JSON
{
"id": "4b7a13cad4a64b12449414487550b7c1f78e7777892da3eacd76942deee81e66",
"pubkey": "9776da7be266185e62a8026a4dc55336839335eaafeb87d4254d251dbfc53ea8",
"created_at": 1687963391,
"kind": 1,
"tags": [
[
"p",
"8bb49bc21657929dddef41fe919427eb4d81b1693fd1cd0952d4b3ee236b005d",
"wss://relay.mostr.pub"
],
[
"p",
"6235fe36d733665c235dbec5983d768400cdb414ea18e0633cfe9d9c1ac6b02d",
"wss://relay.mostr.pub"
],
[
"e",
"ffde7490ea4e3b3723a368849a1fa0a3c9f52b27a0195b852a125fd722256601",
"wss://relay.mostr.pub",
"reply"
],
[
"mostr",
"https://fosstodon.org/users/mmstick/statuses/110622368834285046"
]
],
"content": "nostr:npub13w6fhssk27ffmh00g8lfr9p8adxcrvtf8lgu6z2j6je7ugmtqpws4l479m Yes, and there are multiple ways to achieve this. Using only the standard library, you can use a Rc'd RefCell, which requires a runtime borrow check on each access.\n\nWith the qcell crate, you can use Rc'd QCell/TCell/LCell, based on GhostCell, to achieve the same affect with compile-time borrow checks.\n\nOr you could use generational indices like in the doubly-linked list example for the slotmap crate.\n\nThere's also some graph crates like petgraph.",
"sig": "b7d09f2a6226c84d316e2a763af7e300ed3288f93d2083c7effd2314386ecd456e90f304b4e0af21bdfbaa77cf462e5657002e50526b5a2516343b41df4352a1"
}