Extending struct and trait



I don’t know why you don’t want to implement heritage of classes but it will be easier if will be a macro like: implement_trait_on_object(trait, self.c, except_methods)!

for example:

pub struct Widget {
   c: gtk::Box

impl BoxExt for Widget {
   implement_trait_on_object(BoxExt, self.c, ['get_homogeneous'])!
   fn get_homogeneous(&self) -> bool {

Rust complain about missing 1 parameter but it not display what the missing parameter. In the trait there is only one parameter.

It better if rust display the function header that needed.

error[E0049]: method `set_center_widget` has 1 type parameter but its trait declaration has 2 type parameters
  --> src/widget.rs:63:25
63 |     fn set_center_widget<P: IsA<gtk::Widget>>(&self, widget: Option<&P>)
   |                         ^^^^^^^^^^^^^^^^^^^^^ found 1 type parameter, expected 2

See at: