gstreamer_vulkan/
vulkan_command_pool.rs1use crate::VulkanCommandPool;
2
3use glib::{prelude::*, translate::*};
4
5mod sealed {
6    pub trait Sealed {}
7    impl<T: super::IsA<super::VulkanCommandPool>> Sealed for T {}
8}
9
10#[derive(Debug)]
13pub struct VulkanCommandPoolGuard<'a> {
14    obj: &'a VulkanCommandPool,
15}
16
17impl Drop for VulkanCommandPoolGuard<'_> {
18    fn drop(&mut self) {
19        unsafe {
20            ffi::gst_vulkan_command_pool_unlock(self.obj.to_glib_none().0);
21        }
22    }
23}
24impl PartialEq for VulkanCommandPoolGuard<'_> {
25    fn eq(&self, other: &Self) -> bool {
26        self.obj == other.obj
27    }
28}
29impl Eq for VulkanCommandPoolGuard<'_> {}
30
31pub trait VulkanCommandPoolExtManual: sealed::Sealed + IsA<VulkanCommandPool> + 'static {
32    #[doc(alias = "gst_vulkan_command_pool_lock")]
42    fn lock<'a>(&'a self) -> VulkanCommandPoolGuard<'a> {
43        unsafe {
44            ffi::gst_vulkan_command_pool_lock(self.as_ref().to_glib_none().0);
45        }
46        VulkanCommandPoolGuard {
47            obj: self.upcast_ref(),
48        }
49    }
50}
51impl<O: IsA<VulkanCommandPool>> VulkanCommandPoolExtManual for O {}