From e82e8e0c34c1846e93f1daac056eb2318dfea7ad Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Sun, 22 Oct 2017 14:07:19 +0100 Subject: [PATCH] Needless pass by value Avoid an unnecessary allocation by passing the Caps by reference instead of by value. Fixes https://github.com/sdroege/gstreamer-rs/pull/46 Fixes https://github.com/sdroege/gstreamer-rs/issues/45 --- tutorials/src/bin/basic-tutorial-6.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tutorials/src/bin/basic-tutorial-6.rs b/tutorials/src/bin/basic-tutorial-6.rs index 7dda01525..7f9ab9fe6 100644 --- a/tutorials/src/bin/basic-tutorial-6.rs +++ b/tutorials/src/bin/basic-tutorial-6.rs @@ -3,7 +3,7 @@ use gst::prelude::*; use gst::MessageView; -fn print_caps(caps: gst::Caps, prefix: &str) { +fn print_caps(caps: &gst::Caps, prefix: &str) { if caps.is_any() { println!("{}ANY", prefix); return; @@ -55,7 +55,7 @@ fn print_pad_template_information(factory: &gst::ElementFactory) { let caps = pad_template.get_caps(); println!(" Capabilities:"); - print_caps(caps, " "); + print_caps(&caps, " "); } } @@ -67,11 +67,11 @@ fn print_pad_capabilities(element: &gst::Element, pad_name: &str) { println!("Caps for the {} pad:", pad_name); match pad.get_current_caps() { Some(caps) => { - print_caps(caps, " "); + print_caps(&caps, " "); } None => { let caps = pad.query_caps(None).expect("Failed to query caps on pad"); - print_caps(caps, " "); + print_caps(&caps, " "); } } }