mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-01-11 01:35:26 +00:00
Use impl
for AsRef
trait bounds
This commit is contained in:
parent
0e435578b7
commit
669bf52291
6 changed files with 19 additions and 19 deletions
|
@ -126,7 +126,7 @@ impl AudioConverterConfig {
|
||||||
.unwrap_or(crate::AudioResamplerMethod::BlackmanNuttall)
|
.unwrap_or(crate::AudioResamplerMethod::BlackmanNuttall)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_mix_matrix<T: AsRef<[f32]>>(&mut self, v: &[T]) {
|
pub fn set_mix_matrix(&mut self, v: &[impl AsRef<[f32]>]) {
|
||||||
let length = v.get(0).map(|v| v.as_ref().len()).unwrap_or(0);
|
let length = v.get(0).map(|v| v.as_ref().len()).unwrap_or(0);
|
||||||
let array = gst::Array::from_owned(
|
let array = gst::Array::from_owned(
|
||||||
v.iter()
|
v.iter()
|
||||||
|
|
|
@ -5,9 +5,9 @@ use glib::translate::*;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
#[doc(alias = "gst_type_find_helper_for_data")]
|
#[doc(alias = "gst_type_find_helper_for_data")]
|
||||||
pub fn type_find_helper_for_data<P: IsA<gst::Object>, R: AsRef<[u8]>>(
|
pub fn type_find_helper_for_data(
|
||||||
obj: Option<&P>,
|
obj: Option<&impl IsA<gst::Object>>,
|
||||||
data: R,
|
data: impl AsRef<[u8]>,
|
||||||
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -31,9 +31,9 @@ pub fn type_find_helper_for_data<P: IsA<gst::Object>, R: AsRef<[u8]>>(
|
||||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||||
#[doc(alias = "gst_type_find_helper_for_data_with_extension")]
|
#[doc(alias = "gst_type_find_helper_for_data_with_extension")]
|
||||||
pub fn type_find_helper_for_data_with_extension<P: IsA<gst::Object>, R: AsRef<[u8]>>(
|
pub fn type_find_helper_for_data_with_extension(
|
||||||
obj: Option<&P>,
|
obj: Option<&impl IsA<gst::Object>>,
|
||||||
data: R,
|
data: impl AsRef<[u8]>,
|
||||||
extension: Option<&str>,
|
extension: Option<&str>,
|
||||||
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
|
@ -197,7 +197,7 @@ impl Harness {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(alias = "gst_harness_dump_to_file")]
|
#[doc(alias = "gst_harness_dump_to_file")]
|
||||||
pub fn dump_to_file<P: AsRef<path::Path>>(&mut self, filename: P) {
|
pub fn dump_to_file(&mut self, filename: impl AsRef<path::Path>) {
|
||||||
let filename = filename.as_ref();
|
let filename = filename.as_ref();
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_harness_dump_to_file(self.0.as_ptr(), filename.to_glib_none().0);
|
ffi::gst_harness_dump_to_file(self.0.as_ptr(), filename.to_glib_none().0);
|
||||||
|
|
|
@ -44,15 +44,15 @@ pub trait GstBinExtManual: 'static {
|
||||||
fn children(&self) -> Vec<Element>;
|
fn children(&self) -> Vec<Element>;
|
||||||
|
|
||||||
fn debug_to_dot_data(&self, details: crate::DebugGraphDetails) -> GString;
|
fn debug_to_dot_data(&self, details: crate::DebugGraphDetails) -> GString;
|
||||||
fn debug_to_dot_file<Q: AsRef<path::Path>>(
|
fn debug_to_dot_file(
|
||||||
&self,
|
&self,
|
||||||
details: crate::DebugGraphDetails,
|
details: crate::DebugGraphDetails,
|
||||||
file_name: Q,
|
file_name: impl AsRef<path::Path>,
|
||||||
);
|
);
|
||||||
fn debug_to_dot_file_with_ts<Q: AsRef<path::Path>>(
|
fn debug_to_dot_file_with_ts(
|
||||||
&self,
|
&self,
|
||||||
details: crate::DebugGraphDetails,
|
details: crate::DebugGraphDetails,
|
||||||
file_name: Q,
|
file_name: impl AsRef<path::Path>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn set_bin_flags(&self, flags: BinFlags);
|
fn set_bin_flags(&self, flags: BinFlags);
|
||||||
|
@ -166,18 +166,18 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
|
||||||
crate::debug_bin_to_dot_data(self, details)
|
crate::debug_bin_to_dot_data(self, details)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn debug_to_dot_file<Q: AsRef<path::Path>>(
|
fn debug_to_dot_file(
|
||||||
&self,
|
&self,
|
||||||
details: crate::DebugGraphDetails,
|
details: crate::DebugGraphDetails,
|
||||||
file_name: Q,
|
file_name: impl AsRef<path::Path>,
|
||||||
) {
|
) {
|
||||||
crate::debug_bin_to_dot_file(self, details, file_name)
|
crate::debug_bin_to_dot_file(self, details, file_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn debug_to_dot_file_with_ts<Q: AsRef<path::Path>>(
|
fn debug_to_dot_file_with_ts(
|
||||||
&self,
|
&self,
|
||||||
details: crate::DebugGraphDetails,
|
details: crate::DebugGraphDetails,
|
||||||
file_name: Q,
|
file_name: impl AsRef<path::Path>,
|
||||||
) {
|
) {
|
||||||
crate::debug_bin_to_dot_file_with_ts(self, details, file_name)
|
crate::debug_bin_to_dot_file_with_ts(self, details, file_name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ impl StreamCollectionBuilder {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn streams<S: AsRef<Stream>>(self, streams: &[S]) -> Self {
|
pub fn streams(self, streams: &[impl AsRef<Stream>]) -> Self {
|
||||||
for stream in streams {
|
for stream in streams {
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_stream_collection_add_stream(
|
ffi::gst_stream_collection_add_stream(
|
||||||
|
|
|
@ -634,7 +634,7 @@ impl<'a> Array<'a> {
|
||||||
Array(values.iter().map(|v| v.to_send_value()).collect())
|
Array(values.iter().map(|v| v.to_send_value()).collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_borrowed<T: AsRef<[glib::SendValue]>>(values: &'a T) -> Self {
|
pub fn from_borrowed(values: &'a impl AsRef<[glib::SendValue]>) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
Array(Cow::Borrowed(values.as_ref()))
|
Array(Cow::Borrowed(values.as_ref()))
|
||||||
|
@ -728,7 +728,7 @@ impl<'a> List<'a> {
|
||||||
List(values.iter().map(|v| v.to_send_value()).collect())
|
List(values.iter().map(|v| v.to_send_value()).collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_borrowed<T: AsRef<[glib::SendValue]>>(values: &'a T) -> Self {
|
pub fn from_borrowed(values: &'a impl AsRef<[glib::SendValue]>) -> Self {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
|
|
||||||
List(Cow::Borrowed(values.as_ref()))
|
List(Cow::Borrowed(values.as_ref()))
|
||||||
|
|
Loading…
Reference in a new issue