gtk3-rs icon indicating copy to clipboard operation
gtk3-rs copied to clipboard

Documentation for ScrolledWindow::new misleading

Open donaldcallen opened this issue 5 years ago • 2 comments

"Usually you want to pass None for the adjustments, which will cause the scrolled window to create them for you."

Pass 'None' for the adjustments leads to

error[E0283]: type annotations required: cannot resolve _: gtk::IsA<gtk::Adjustment> --> src/main.rs:159:42 | 159 | let scrolled_window:ScrolledWindow = ScrolledWindow::new(None, None); | ^^^^^^^^^^^^^^^^^^^ | = note: required by gtk::ScrolledWindow::new

You have gtk::NONE_ADJUSTMENT defined. Why not mention that in the documentation instead of 'None' and avoid leading users down this incorrect path?

donaldcallen avatar Aug 02 '19 12:08 donaldcallen

Relevant thread on URLO where we dug into this error: https://users.rust-lang.org/t/do-not-understand-this-error/30924/

17cupsofcoffee avatar Aug 02 '19 12:08 17cupsofcoffee

You can also pass None::<&gtk::Adjustment> FWIW. These problems exist because functions can't declare default types for generic parameters yet.

sdroege avatar Nov 10 '20 15:11 sdroege