I've implemented a set of personal finance tools in Rust. In the main application, I use the gtk crate to provide a gui for editing the sqlite financial database.
This has worked just fine for a year or so. Then I noted that the gtk crate had been updated and I edited my cargo.toml files to allow the new version to be used. Bad idea. In the main application, I have a line in the initialization code:
let scrolled_window = ScrolledWindow::new(None, None);
This line provokes the following error:
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`
From the gtk (crate) documentation:
#### `pub fn new<P: IsA<Adjustment>, Q: IsA<Adjustment>>( hadjustment: Option<&P>, vadjustment: Option<&Q>) -> ScrolledWindow` Creates a new scrolled window. The two arguments are the scrolled window’s adjustments; these will be shared with the scrollbars and the child widget to keep the bars in sync with the child. Usually you want to pass `None` for the adjustments, which will cause the scrolled window to create them for you.
This code worked in the previous version and furthermore is doing what is suggested in the documentation -- passing None for the two adjustment arguments. Why is there a complaint about IsA when those argument types are both Option<&P>, where P implements the IsA trait, when None is an Option? That's where I run out of ideas.
Help would be appreciated.