Creating Weak from &T?

⚓ Rust    📅 2026-02-02    👤 surdeus    👁️ 7      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Creating Weak from &T?

I presume I am missing something obvious. In some methods on a struct, I want to create a weak reference to the structure. As far as I can tell, for good reasons, I need to get to an Rc, and then I can call Rc::downgrade(...) to get to a Weak. But when I try to figure out how to create an Rc, I end up seeing various Clone methods. I don't want a reference to a clone of the object. And &Self is not an Rc. What am I missing?
Thanks,
Joel

5 posts - 4 participants

Read full topic

🏷️ Rust_feed