this post was submitted on 21 Jul 2023
5 points (77.8% liked)

Rust Programming

8427 readers
111 users here now

founded 5 years ago
MODERATORS
 

Hi everybody, I'm new to Rust.

So, I have a struct Panel which contains a data widget which implements the trait Widget I have to implement a function for Panel that uses another function that requires a type that implements Widget.

I tried Box<T>, Rc<T>, Box<dyn Widget, &T, but nothing, always compiler errors.

How can I fix this?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 2 years ago

Can you give a code example of what you have tried to do already?