Add 'static trait bound to all ExtManual traits and get rid of trait bounds for their impls

This commit is contained in:
Sebastian Dröge 2018-12-08 11:22:42 +02:00
parent 5c93e134a7
commit 6bba3d8518
26 changed files with 34 additions and 36 deletions

View file

@ -14,7 +14,7 @@ use Aggregator;
use std::ops;
pub trait AggregatorExtManual {
pub trait AggregatorExtManual: 'static {
fn finish_buffer(&self, buffer: gst::Buffer) -> gst::FlowReturn;
}

View file

@ -15,7 +15,7 @@ use AggregatorPad;
use std::ops;
pub trait AggregatorPadExtManual {
pub trait AggregatorPadExtManual: 'static {
fn get_segment(&self) -> gst::Segment;
}

View file

@ -13,7 +13,7 @@ use gst;
use std::ops;
use BaseSink;
pub trait BaseSinkExtManual {
pub trait BaseSinkExtManual: 'static {
fn get_segment(&self) -> gst::Segment;
}

View file

@ -13,7 +13,7 @@ use gst;
use std::ops;
use BaseSrc;
pub trait BaseSrcExtManual {
pub trait BaseSrcExtManual: 'static {
fn get_segment(&self) -> gst::Segment;
}

View file

@ -13,7 +13,7 @@ use gst;
use std::ops;
use BaseTransform;
pub trait BaseTransformExtManual {
pub trait BaseTransformExtManual: 'static {
fn get_segment(&self) -> gst::Segment;
}

View file

@ -13,7 +13,7 @@ use glib::translate::*;
use std::ptr;
use TimelineElement;
pub trait TimelineElementExtManual {
pub trait TimelineElementExtManual: 'static {
fn get_child_property(&self, name: &str) -> Option<glib::Value>;
fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError>;
}

View file

@ -31,7 +31,7 @@ impl GLContext {
}
}
pub trait GLContextExtManual {
pub trait GLContextExtManual: 'static {
fn get_gl_context(&self) -> uintptr_t;
fn get_proc_address(&self, name: &str) -> uintptr_t;

View file

@ -6,7 +6,7 @@ use RTSPAddress;
use RTSPAddressPool;
use RTSPAddressPoolResult;
pub trait RTSPAddressPoolExtManual {
pub trait RTSPAddressPoolExtManual: 'static {
fn reserve_address(
&self,
ip_address: &str,

View file

@ -4,7 +4,7 @@ use glib::translate::*;
use RTSPAuth;
use RTSPToken;
pub trait RTSPAuthExtManual {
pub trait RTSPAuthExtManual: 'static {
fn set_default_token<'a, P: Into<Option<&'a mut RTSPToken>>>(&self, token: P);
}

View file

@ -5,7 +5,7 @@ use glib::source::SourceId;
use glib::translate::*;
use RTSPClient;
pub trait RTSPClientExtManual {
pub trait RTSPClientExtManual: 'static {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId;
}

View file

@ -14,7 +14,7 @@ use glib::IsA;
#[cfg(any(feature = "v1_14", feature = "dox"))]
use gst;
pub trait RTSPMediaFactoryExtManual {
pub trait RTSPMediaFactoryExtManual: 'static {
#[cfg(any(feature = "v1_14", feature = "dox"))]
fn add_role_from_structure(&self, structure: &gst::StructureRef);
}

View file

@ -5,7 +5,7 @@ use glib::source::SourceId;
use glib::translate::*;
use RTSPServer;
pub trait RTSPServerExtManual {
pub trait RTSPServerExtManual: 'static {
fn attach<'a, P: Into<Option<&'a glib::MainContext>>>(&self, context: P) -> SourceId;
}

View file

@ -31,7 +31,7 @@ fn into_raw_watch<F: FnMut(&RTSPSessionPool) -> Continue + Send + 'static>(func:
Box::into_raw(func) as gpointer
}
pub trait RTSPSessionPoolExtManual {
pub trait RTSPSessionPoolExtManual: 'static {
fn create_watch<'a, N: Into<Option<&'a str>>, F>(
&self,
name: N,

View file

@ -15,7 +15,7 @@ use VideoOverlay;
use glib::IsA;
pub trait VideoOverlayExtManual {
pub trait VideoOverlayExtManual: 'static {
unsafe fn set_window_handle(&self, handle: uintptr_t);
unsafe fn got_window_handle(&self, handle: uintptr_t);
}

View file

@ -18,7 +18,7 @@ use ffi;
use std::ops;
use std::path;
pub trait GstBinExtManual {
pub trait GstBinExtManual: 'static {
fn add_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError>;
fn remove_many<E: IsA<Element>>(&self, elements: &[&E]) -> Result<(), glib::BoolError>;

View file

@ -225,7 +225,7 @@ impl Default for BufferPool {
}
}
pub trait BufferPoolExtManual {
pub trait BufferPoolExtManual: 'static {
fn get_config(&self) -> BufferPoolConfig;
fn set_config(&self, config: BufferPoolConfig) -> Result<(), glib::error::BoolError>;

View file

@ -27,7 +27,7 @@ cfg_if! {
use super::Bus;
pub trait UnixBusExtManual {
pub trait UnixBusExtManual: 'static {
fn get_pollfd(&self) -> unix::io::RawFd;
}

View file

@ -27,7 +27,7 @@ cfg_if! {
use super::Bus;
pub trait WindowsBusExtManual {
pub trait WindowsBusExtManual: 'static {
fn get_pollfd(&self) -> windows::io::RawHandle;
}

View file

@ -13,7 +13,7 @@ use glib::translate::*;
use std::ptr;
use ChildProxy;
pub trait ChildProxyExtManual {
pub trait ChildProxyExtManual: 'static {
fn get_child_property(&self, name: &str) -> Option<glib::Value>;
fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError>;
}

View file

@ -163,7 +163,7 @@ impl Clock {
}
}
pub trait ClockExtManual {
pub trait ClockExtManual: 'static {
fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> Option<ClockId>;
fn periodic_id_reinit(
@ -178,7 +178,7 @@ pub trait ClockExtManual {
fn single_shot_id_reinit(&self, id: &ClockId, time: ClockTime) -> Result<(), glib::BoolError>;
}
impl<O: IsA<Clock> + IsA<glib::object::Object>> ClockExtManual for O {
impl<O: IsA<Clock>> ClockExtManual for O {
fn new_periodic_id(&self, start_time: ClockTime, interval: ClockTime) -> Option<ClockId> {
unsafe {
from_glib_full(ffi::gst_clock_new_periodic_id(

View file

@ -16,7 +16,7 @@ use std::ffi::CStr;
use ffi;
use gobject_ffi;
pub trait DeviceProviderExtManual {
pub trait DeviceProviderExtManual: 'static {
fn get_metadata<'a>(&self, key: &str) -> Option<&'a str>;
}

View file

@ -92,7 +92,7 @@ impl FromGlib<libc::c_ulong> for NotifyWatchId {
}
}
pub trait ElementExtManual {
pub trait ElementExtManual: 'static {
fn get_element_class(&self) -> &ElementClass;
fn query(&self, query: &mut QueryRef) -> bool;

View file

@ -4,7 +4,7 @@ use glib::IsA;
use ffi;
pub trait GObjectExtManualGst {
pub trait GObjectExtManualGst: 'static {
fn set_property_from_str(&self, name: &str, value: &str);
}

View file

@ -9,12 +9,12 @@
use glib;
use glib::object::{Downcast, ObjectExt};
use glib::signal::SignalHandlerId;
use glib::translate::{from_glib_none, ToGlibPtr};
use glib::translate::{from_glib_borrow, from_glib_none, ToGlibPtr};
use glib::IsA;
use gobject_ffi;
pub trait GstObjectExtManual {
pub trait GstObjectExtManual: 'static {
fn connect_deep_notify<
'a,
P: Into<Option<&'a str>>,
@ -26,7 +26,7 @@ pub trait GstObjectExtManual {
) -> SignalHandlerId;
}
impl<O: IsA<::Object> + IsA<glib::Object> + glib::value::SetValue> GstObjectExtManual for O {
impl<O: IsA<::Object>> GstObjectExtManual for O {
fn connect_deep_notify<
'a,
P: Into<Option<&'a str>>,
@ -43,13 +43,11 @@ impl<O: IsA<::Object> + IsA<glib::Object> + glib::value::SetValue> GstObjectExtM
"deep-notify".into()
};
self.connect(signal_name.as_str(), false, move |values| {
let obj: O = unsafe {
values[0]
.get::<glib::Object>()
.unwrap()
.downcast_unchecked()
};
let obj: glib::Object =
unsafe { from_glib_borrow(self.to_glib_none().0 as *mut gobject_ffi::GObject) };
obj.connect(signal_name.as_str(), false, move |values| {
let obj: O = unsafe { values[0].get::<::Object>().unwrap().downcast_unchecked() };
let prop_obj: ::Object = values[1].get().unwrap();
let pspec = unsafe {

View file

@ -105,7 +105,7 @@ impl Drop for StreamLock {
}
}
pub trait PadExtManual {
pub trait PadExtManual: 'static {
fn add_probe<F>(&self, mask: PadProbeType, func: F) -> Option<PadProbeId>
where
F: Fn(&Pad, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static;

View file

@ -14,7 +14,7 @@ use tags::*;
use TagMergeMode;
use TagSetter;
pub trait TagSetterExtManual {
pub trait TagSetterExtManual: 'static {
fn add<'a, T: Tag<'a>>(&self, value: T::TagType, mode: TagMergeMode)
where
T::TagType: ToSendValue;