Way to avoid a self-referential struct
@kpreid Kevi
·
2026-04-23
·
via The Rust Programming Language Forum - Latest posts
Especially if the library is still in development, you should consider contributing a fix for the problem. One possible shape of a fix is to make it generic over a trait that is implemented for all of A , &A , Arc<A> , etc., or — if it makes sense to always require a pointer — make it generic over P: Deref<Target = A> . Library authors often don’t realize how serious a problem this is, because it is not a problem for test cases and simple “batch processing”-shaped programs, and only shows up as an issue in more complex applications with more separation of concerns and other constraints on the control flow.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。