5
submitted 3 years ago by djtech@lemmy.world to c/rust@lemmy.ml

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
[-] nivenkos@lemmy.world 3 points 3 years ago

You need to post the errors. What is the function signature?

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

Rust Programming

9435 readers
1 users here now

founded 7 years ago
MODERATORS