Allow anything that implements Into<Option<&str>> to be used for creating new pads

This commit is contained in:
Sebastian Dröge 2017-11-21 16:14:39 +02:00
parent 483b40679a
commit 94ba143c74

View file

@ -38,8 +38,12 @@ use libc;
use ffi;
impl Pad {
pub fn new_from_static_template(templ: &StaticPadTemplate, name: &str) -> Pad {
pub fn new_from_static_template<'a, P: Into<Option<&'a str>>>(
templ: &StaticPadTemplate,
name: P,
) -> Pad {
assert_initialized_main_thread!();
let name = name.into();
unsafe {
from_glib_none(ffi::gst_pad_new_from_static_template(
mut_override(templ.to_glib_none().0),