gtk-rs / gtk4-rs

Rust bindings of GTK 4
https://gtk-rs.org/gtk4-rs/
MIT License
1.9k stars 174 forks source link

MediaStreamExt::error() requires a fully-qualified call now #339

Closed YaLTeR closed 3 years ago

YaLTeR commented 3 years ago

I updated to latest gtk4-rs: https://gitlab.gnome.org/YaLTeR/video-trimmer/-/commit/83e0f4015484ad3c566db2d11fa9f126a12cb65c#596ffd44ab388aa7cc024f7219a9c39f7788215f

Generally everything became better, except this one change I had to do: https://gitlab.gnome.org/YaLTeR/video-trimmer/-/commit/83e0f4015484ad3c566db2d11fa9f126a12cb65c#596ffd44ab388aa7cc024f7219a9c39f7788215f_153_147

-let error = media_file.get_error().unwrap();
+let error = MediaStreamExt::error(media_file).unwrap();

Because error() is also found in a few other associated traits. I wonder why it worked before with get_error() then?

sdroege commented 3 years ago

Do you have a list of other traits?

YaLTeR commented 3 years ago
error[E0034]: multiple applicable items in scope
   --> src/video_preview.rs:138:44
    |
138 |                     let error = media_file.error().unwrap();
    |                                            ^^^^^ multiple `error` found
    |
    = note: candidate #1 is defined in an impl of the trait `gtk4::prelude::GLAreaExt` for the type `O`
    = note: candidate #2 is defined in an impl of the trait `gtk4::prelude::MediaStreamExt` for the type `O`
    = note: candidate #3 is defined in an impl of the trait `gtk4::prelude::PrintOperationExt` for the type `O`
    = note: candidate #4 is defined in an impl of the trait `gtk4::prelude::MediaStreamExtManual` for the type `O`
help: disambiguate the associated function for candidate #1
    |
138 |                     let error = gtk4::prelude::GLAreaExt::error(&media_file).unwrap();
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #2
    |
138 |                     let error = gtk4::prelude::MediaStreamExt::error(&media_file).unwrap();
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #3
    |
138 |                     let error = gtk4::prelude::PrintOperationExt::error(&media_file).unwrap();
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: disambiguate the associated function for candidate #4
    |
138 |                     let error = gtk4::prelude::MediaStreamExtManual::error(&media_file).unwrap();
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sdroege commented 3 years ago

= note: candidate #2 is defined in an impl of the trait gtk4::prelude::MediaStreamExt for the type O = note: candidate #4 is defined in an impl of the trait gtk4::prelude::MediaStreamExtManual for the type O

These two are probably the problem. They both apply to the current type, so the compiler can't make a decision for you. If one disappears it should compile fine.

bilelmoussaoui commented 3 years ago

Ah yes there's a method to get and set the error that have the same name. We should prefix the setter with set_, that would fix the issue.

YaLTeR commented 3 years ago

Thanks, that worked