mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
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
This commit is contained in:
parent
342d89dd44
commit
95dc336b65
1 changed files with 28 additions and 35 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue