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§
const TYPE: ObjectType
Required Associated Types§
Required Methods§
Sourcefn as_raw(&self) -> Self::InnerType
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
Provided Methods§
Sourceunsafe fn try_from_raw<T>(x: T) -> Option<Self>
unsafe fn try_from_raw<T>(x: T) -> Option<Self>
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
Sourcefn borrow<'a>(&'a self) -> BorrowedHandle<'a, Self>
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
Sourcefn borrow_mut<'a>(&'a mut self) -> BorrowedMutHandle<'a, Self>
fn borrow_mut<'a>(&'a mut self) -> BorrowedMutHandle<'a, Self>
See Handle::borrow
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.