gstreamer/auto/
ghost_pad.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, Object, Pad, ProxyPad};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    #[doc(alias = "GstGhostPad")]
11    pub struct GhostPad(Object<ffi::GstGhostPad, ffi::GstGhostPadClass>) @extends ProxyPad, Pad, Object;
12
13    match fn {
14        type_ => || ffi::gst_ghost_pad_get_type(),
15    }
16}
17
18impl GhostPad {
19    pub const NONE: Option<&'static GhostPad> = None;
20}
21
22unsafe impl Send for GhostPad {}
23unsafe impl Sync for GhostPad {}
24
25mod sealed {
26    pub trait Sealed {}
27    impl<T: super::IsA<super::GhostPad>> Sealed for T {}
28}
29
30pub trait GhostPadExt: IsA<GhostPad> + sealed::Sealed + 'static {
31    #[doc(alias = "gst_ghost_pad_get_target")]
32    #[doc(alias = "get_target")]
33    fn target(&self) -> Option<Pad> {
34        unsafe {
35            from_glib_full(ffi::gst_ghost_pad_get_target(
36                self.as_ref().to_glib_none().0,
37            ))
38        }
39    }
40
41    #[doc(alias = "gst_ghost_pad_set_target")]
42    fn set_target(&self, newtarget: Option<&impl IsA<Pad>>) -> Result<(), glib::error::BoolError> {
43        unsafe {
44            glib::result_from_gboolean!(
45                ffi::gst_ghost_pad_set_target(
46                    self.as_ref().to_glib_none().0,
47                    newtarget.map(|p| p.as_ref()).to_glib_none().0
48                ),
49                "Failed to set target"
50            )
51        }
52    }
53}
54
55impl<O: IsA<GhostPad>> GhostPadExt for O {}