gstreamer_vulkan/auto/
vulkan_command_pool.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, VulkanCommandBuffer, VulkanQueue};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    ///
11    ///
12    /// # Implements
13    ///
14    /// [`VulkanCommandPoolExt`][trait@crate::prelude::VulkanCommandPoolExt], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
15    #[doc(alias = "GstVulkanCommandPool")]
16    pub struct VulkanCommandPool(Object<ffi::GstVulkanCommandPool, ffi::GstVulkanCommandPoolClass>) @extends gst::Object;
17
18    match fn {
19        type_ => || ffi::gst_vulkan_command_pool_get_type(),
20    }
21}
22
23impl VulkanCommandPool {
24    pub const NONE: Option<&'static VulkanCommandPool> = None;
25}
26
27unsafe impl Send for VulkanCommandPool {}
28unsafe impl Sync for VulkanCommandPool {}
29
30/// Trait containing all [`struct@VulkanCommandPool`] methods.
31///
32/// # Implementors
33///
34/// [`VulkanCommandPool`][struct@crate::VulkanCommandPool]
35pub trait VulkanCommandPoolExt: IsA<VulkanCommandPool> + 'static {
36    ///
37    /// # Returns
38    ///
39    /// a new or recycled primary [`VulkanCommandBuffer`][crate::VulkanCommandBuffer]
40    #[doc(alias = "gst_vulkan_command_pool_create")]
41    fn create(&self) -> Result<VulkanCommandBuffer, glib::Error> {
42        unsafe {
43            let mut error = std::ptr::null_mut();
44            let ret =
45                ffi::gst_vulkan_command_pool_create(self.as_ref().to_glib_none().0, &mut error);
46            if error.is_null() {
47                Ok(from_glib_full(ret))
48            } else {
49                Err(from_glib_full(error))
50            }
51        }
52    }
53
54    ///
55    /// # Returns
56    ///
57    /// the parent [`VulkanQueue`][crate::VulkanQueue] for this command pool
58    #[doc(alias = "gst_vulkan_command_pool_get_queue")]
59    #[doc(alias = "get_queue")]
60    fn queue(&self) -> VulkanQueue {
61        unsafe {
62            from_glib_full(ffi::gst_vulkan_command_pool_get_queue(
63                self.as_ref().to_glib_none().0,
64            ))
65        }
66    }
67}
68
69impl<O: IsA<VulkanCommandPool>> VulkanCommandPoolExt for O {}