[Solved] How can i call a method in another struct/trait


Hi i try to call a method in another trait.
Maybe is std::sync::Arc or std::cell::RefCell the answer?
I have at the moment no idea how i can solve this problem.

I created a example with my problem:

thanks :slight_smile:


Here’s a quick fix:


(edit: sorry, wrong link when I posted first, it’s now fixed).


Unless you have a specific reason to want a trait object in draw_line_algorithm, you should change it to be generic:

fn draw_line_algorithm<D: Draw + ?Sized>(drawer: &mut D) { ... }


Perfect! Thanks, this is exactly what i needed. :grinning: