Trait Handle

Source
pub trait Handle: Sealed + Sized {
    type InnerType: Copy;

    const TYPE: ObjectType;

    // Required methods
    fn as_raw(&self) -> Self::InnerType;
    unsafe fn from_raw(x: Self::InnerType) -> Self;
    unsafe fn clone(&self) -> Self;

    // Provided methods
    unsafe fn try_from_raw<T>(x: T) -> Option<Self>
       where Self::InnerType: TryFrom<T> { ... }
    fn borrow<'a>(&'a self) -> BorrowedHandle<'a, Self> { ... }
    fn borrow_mut<'a>(&'a mut self) -> BorrowedMutHandle<'a, Self> { ... }
}
Expand description

A dispatchable or non-dispatchable Vulkan Handle

Required Associated Constants§

Required Associated Types§

Required Methods§

Source

fn as_raw(&self) -> Self::InnerType

Retrieve the inner content of the vulkan handle, to be used by other Vulkan librairies not using this crate

Source

unsafe fn from_raw(x: Self::InnerType) -> Self

Convert a pointer to a handle When calling this code, the user must ensure the following:

  • The pointer given is a valid Vulkan handle for the appropriate type
  • The handle must live at least as long as the object being created
Source

unsafe fn clone(&self) -> Self

clone the current object, this function is unsafe as the caller must ensure that only one of the two handles is destroyed, moreover, the second handle must not be used after the first has been destroyed

Provided Methods§

Source

unsafe fn try_from_raw<T>(x: T) -> Option<Self>
where Self::InnerType: TryFrom<T>,

Same as Handle::from_raw but allows for types that can be zero (usize or u64 depending on the handle) Will fail if x is null/zero

Source

fn borrow<'a>(&'a self) -> BorrowedHandle<'a, Self>

Return a representation of &self The advantage is that BorrowedHandle<’a, Self> has internally the exact same memory representation as the raw handle it represents and therefore should be used when a deref is not enough like for vulkan commands that require arrays of handles

Source

fn borrow_mut<'a>(&'a mut self) -> BorrowedMutHandle<'a, Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Handle for AccelerationStructureKHR

Source§

const TYPE: ObjectType = ObjectType::AccelerationStructureKHR

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for AccelerationStructureNV

Source§

const TYPE: ObjectType = ObjectType::AccelerationStructureNV

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for Buffer

Source§

const TYPE: ObjectType = ObjectType::Buffer

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for BufferCollectionFUCHSIA

Source§

const TYPE: ObjectType = ObjectType::BufferCollectionFUCHSIA

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for BufferView

Source§

const TYPE: ObjectType = ObjectType::BufferView

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for CommandBuffer

Source§

const TYPE: ObjectType = ObjectType::CommandBuffer

Source§

type InnerType = NonZero<usize>

Source§

impl Handle for CommandPool

Source§

const TYPE: ObjectType = ObjectType::CommandPool

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for CuFunctionNVX

Source§

const TYPE: ObjectType = ObjectType::CuFunctionNVX

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for CuModuleNVX

Source§

const TYPE: ObjectType = ObjectType::CuModuleNVX

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for CudaFunctionNV

Source§

const TYPE: ObjectType = ObjectType::CudaFunctionNV

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for CudaModuleNV

Source§

const TYPE: ObjectType = ObjectType::CudaModuleNV

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for DebugReportCallbackEXT

Source§

const TYPE: ObjectType = ObjectType::DebugReportCallbackEXT

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for DebugUtilsMessengerEXT

Source§

const TYPE: ObjectType = ObjectType::DebugUtilsMessengerEXT

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for DeferredOperationKHR

Source§

const TYPE: ObjectType = ObjectType::DeferredOperationKHR

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for DescriptorPool

Source§

const TYPE: ObjectType = ObjectType::DescriptorPool

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for DescriptorSet

Source§

const TYPE: ObjectType = ObjectType::DescriptorSet

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for DescriptorSetLayout

Source§

const TYPE: ObjectType = ObjectType::DescriptorSetLayout

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for DescriptorUpdateTemplate

Source§

const TYPE: ObjectType = ObjectType::DescriptorUpdateTemplate

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for Device

Source§

const TYPE: ObjectType = ObjectType::Device

Source§

type InnerType = NonZero<usize>

Source§

impl Handle for DeviceMemory

Source§

const TYPE: ObjectType = ObjectType::DeviceMemory

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for DisplayKHR

Source§

const TYPE: ObjectType = ObjectType::DisplayKHR

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for DisplayModeKHR

Source§

const TYPE: ObjectType = ObjectType::DisplayModeKHR

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for Event

Source§

const TYPE: ObjectType = ObjectType::Event

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for ExternalComputeQueueNV

Source§

const TYPE: ObjectType = ObjectType::ExternalComputeQueueNV

Source§

type InnerType = NonZero<usize>

Source§

impl Handle for Fence

Source§

const TYPE: ObjectType = ObjectType::Fence

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for Framebuffer

Source§

const TYPE: ObjectType = ObjectType::Framebuffer

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for Image

Source§

const TYPE: ObjectType = ObjectType::Image

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for ImageView

Source§

const TYPE: ObjectType = ObjectType::ImageView

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for IndirectCommandsLayoutEXT

Source§

const TYPE: ObjectType = ObjectType::IndirectCommandsLayoutEXT

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for IndirectCommandsLayoutNV

Source§

const TYPE: ObjectType = ObjectType::IndirectCommandsLayoutNV

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for IndirectExecutionSetEXT

Source§

const TYPE: ObjectType = ObjectType::IndirectExecutionSetEXT

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for Instance

Source§

const TYPE: ObjectType = ObjectType::Instance

Source§

type InnerType = NonZero<usize>

Source§

impl Handle for MicromapEXT

Source§

const TYPE: ObjectType = ObjectType::MicromapEXT

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for OpticalFlowSessionNV

Source§

const TYPE: ObjectType = ObjectType::OpticalFlowSessionNV

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for PerformanceConfigurationINTEL

Source§

const TYPE: ObjectType = ObjectType::PerformanceConfigurationINTEL

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for PhysicalDevice

Source§

const TYPE: ObjectType = ObjectType::PhysicalDevice

Source§

type InnerType = NonZero<usize>

Source§

impl Handle for Pipeline

Source§

const TYPE: ObjectType = ObjectType::Pipeline

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for PipelineBinaryKHR

Source§

const TYPE: ObjectType = ObjectType::PipelineBinaryKHR

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for PipelineCache

Source§

const TYPE: ObjectType = ObjectType::PipelineCache

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for PipelineLayout

Source§

const TYPE: ObjectType = ObjectType::PipelineLayout

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for PrivateDataSlot

Source§

const TYPE: ObjectType = ObjectType::PrivateDataSlot

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for QueryPool

Source§

const TYPE: ObjectType = ObjectType::QueryPool

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for Queue

Source§

const TYPE: ObjectType = ObjectType::Queue

Source§

type InnerType = NonZero<usize>

Source§

impl Handle for RenderPass

Source§

const TYPE: ObjectType = ObjectType::RenderPass

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for Sampler

Source§

const TYPE: ObjectType = ObjectType::Sampler

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for SamplerYcbcrConversion

Source§

const TYPE: ObjectType = ObjectType::SamplerYcbcrConversion

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for Semaphore

Source§

const TYPE: ObjectType = ObjectType::Semaphore

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for ShaderEXT

Source§

const TYPE: ObjectType = ObjectType::ShaderEXT

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for ShaderModule

Source§

const TYPE: ObjectType = ObjectType::ShaderModule

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for SurfaceKHR

Source§

const TYPE: ObjectType = ObjectType::SurfaceKHR

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for SwapchainKHR

Source§

const TYPE: ObjectType = ObjectType::SwapchainKHR

Source§

type InnerType = NonZero<u64>

Source§

impl Handle for ValidationCacheEXT

Source§

const TYPE: ObjectType = ObjectType::ValidationCacheEXT

Source§

type InnerType = NonZero<u64>