Commit 95dc336b authored by Luis de Bethencourt's avatar Luis de Bethencourt Committed by Sebastian Dröge

Use while let

When destructuring a single pattern in a loop it is nicer to use while let.

Fixes https://github.com/sdroege/gstreamer-rs/pull/46
Fixes https://github.com/sdroege/gstreamer-rs/issues/45
parent 342d89dd
......@@ -119,11 +119,7 @@ fn main() {
// Wait until error, EOS or State Change
let bus = pipeline.get_bus().unwrap();
loop {
let msg = bus.timed_pop(gst::CLOCK_TIME_NONE);
match msg {
Some(msg) => {
while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
match msg.view() {
MessageView::Error(err) => {
println!(
......@@ -154,9 +150,6 @@ fn main() {
_ => (),
}
}
None => (),
}
}
// Shutdown pipeline
let ret = pipeline.set_state(gst::State::Null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment