On Mon, Nov 4, 2013 at 1:11 AM, Oren Ben-Kiki <[email protected]> wrote:

> I am toying with a non-trivial Rust project to get a feel for the
> language. There's a pattern I keep seeing in my code which isn't easy to
> express in Rust. I wonder what the "right thing to do" is here.
>
> The pattern is as follows. I have some container, which contains some
> components of different types. The container as a whole is send-able . The
> components form a complex graph (with cycles).
>

If there are keys, the path of least resistance is to use a map or a pair
of maps. Reference counting can allow cyclic links in data structures as
long as the ownership graph is acyclic, but Rust doesn't offer a type like
this at the moment.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to