nadav
April 26, 2019, 9:14am
1
Hello
I try to extend gtk component:
fn set_center_widget<P: IsA<gtk::Widget>>(&self, widget: Option<&P>)
{self.c.set_center_widget(widget)}
but it complain on:
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
Thanks
If you don't show us the trait declaration, it'll be hard to help you...
nadav
April 26, 2019, 10:07am
3
The trait declaration is:
fn set_center_widget<P: IsA<Widget>>(&self, widget: Option<&P>);
from:
https://github.com/gtk-rs/gtk/blob/master/src/auto/box_.rs
Hmm, admittedly, that set_center_widget
has only one type parameter... Could it be brought in scope from somewhere else? Another version of the gtk crate?
nadav
April 26, 2019, 10:25am
5
In the Cargo.toml I use:
[dependencies.gtk]
version = "0.6.0"
features = ["v3_16"]
but even in this version it is the same declaration:
fn set_center_widget<'a, P: IsA<Widget> + 'a, Q: Into<Option<&'a P>>>(&self, widget: Q);
https://github.com/gtk-rs/gtk/blob/0.6.0/src/auto/box_.rs
duncan
April 26, 2019, 2:17pm
6
Are we looking at the same thing? I see 2 type parameters in the trait declaration:
fn set_center_widget<'a, P: IsA<Widget> + 'a, Q: Into<Option<&'a P>>>(&self, widget: Q);
https://github.com/gtk-rs/gtk/blob/0.6.0/src/auto/box_.rs#L64
1 Like
nadav
April 26, 2019, 2:29pm
7
Thanks! I looked only the
(&self, widget: Q)
part.
system
Closed
July 25, 2019, 2:47pm
9
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.