crosspostato da: https://lemmy.world/post/1916287
Hi everybody, I’m new to Rust.
So, I have a struct
Panel
which contains a datawidget
which implements the traitWidget
I have to implement a function forPanel
that uses another function that requires a type that implementsWidget
.I tried
Box<T>
,Rc<T>
,Box<dyn Widget
,&T
, but nothing, always compiler errors.How can I fix this?
You must log in or register to comment.
It’s really not possible to answer your question with the information you provided. Just saying “there’s an error” doesn’t tell us much.
You need to include actual code and the full error messages. Ideally, create a minimal example in the Rust playground that reproduces the issue and then link it: https://play.rust-lang.org/