Flag handling snippet in playbin example is outdated
To reproduce, uncomment this snippet (I've used 2a9d0d03) and run cargo check --bin playbin
:
error[E0599]: no method named `get_property` found for struct `gstreamer::Element` in the current scope
--> examples/src/bin/playbin.rs:40:25
|
40 | let flags = playbin.get_property("flags").unwrap();
| ^^^^^^^^^^^^ method not found in `Element`
error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> examples/src/bin/playbin.rs:41:23
|
41 | let flags_class = FlagsClass::new(flags.type_()).unwrap();
| ^^^^^^^^^^^^^^^ -------------
| |
| unexpected argument
| help: remove the extra argument
|
note: associated function defined here
--> /home/naglis/.cargo/git/checkouts/gtk-rs-core-7be42ca38bd6361c/dc264f6/glib/src/enums.rs:421:12
|
421 | pub fn new<T: StaticType + HasParamSpec<ParamSpec = ParamSpecFlags>>() -> Self {
| ^^^
error[E0599]: no method named `unwrap` found for struct `FlagsClass` in the current scope
--> examples/src/bin/playbin.rs:41:54
|
41 | let flags_class = FlagsClass::new(flags.type_()).unwrap();
| ^^^^^^ method not found in `FlagsClass`
error[E0599]: no method named `unwrap` found for unit type `()` in the current scope
--> examples/src/bin/playbin.rs:49:54
|
49 | playbin.set_property_from_value("flags", &flags).unwrap();
| ^^^^^^ method not found in `()`
Some errors have detailed explanations: E0061, E0599.
For more information about an error, try `rustc --explain E0061`.
FWIW, I've got it working again via these changes:
- // let flags = playbin.get_property("flags").unwrap();
- // let flags_class = FlagsClass::new(flags.type_()).unwrap();
+ // let flags = playbin.property_value("flags");
+ // let flags_class = FlagsClass::with_type(flags.type_()).unwrap();
// let flags = flags_class.builder_with_value(flags).unwrap()
// .unset_by_nick("text")
// .unset_by_nick("video")
// .build()
// .unwrap();
- // playbin.set_property_from_value("flags", &flags).unwrap();
+ // playbin.set_property_from_value("flags", &flags);