Flutterby™! : Okay Rust geeks dumb newbie Q I need

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

Okay Rust geeks dumb newbie Q I need

2025-01-06 04:50:02.349284+01 by Dan Lyke 0 comments

Okay, Rust geeks, dumb newbie Q: I need a circular reference, so I'm going to just keep indices in a `Vec<Box<dyn ParseNode >>` arena.

The ParseNode trait has a `fn add_node(&mut self,...)` so that I can add the reference.

I want a `pub fn node(&self, idx : usize) -> &mut Box<dyn ParseNode>` to access that node, but I cannot figure out how to annotate the array to let me return the mutable reference that would let me call my `p.node(idx).add_node(other_idx)` method.

[ related topics: Handicaps & Disabilities ]

comments in ascending chronological order (reverse):