pub struct MetalBufferHandle { /* private fields */ }Expand description
MTLBuffer*.
Implementations§
Source§impl MetalBufferHandle
impl MetalBufferHandle
Sourcepub unsafe fn try_from_raw(
buf: *mut c_void,
row_pitch: u32,
registry_id: Option<u64>,
keep_alive: Option<KeepAlive>,
) -> Result<Self, InvalidHandleError>
pub unsafe fn try_from_raw( buf: *mut c_void, row_pitch: u32, registry_id: Option<u64>, keep_alive: Option<KeepAlive>, ) -> Result<Self, InvalidHandleError>
Wrap a raw id<MTLBuffer>. Borrowing: the handle is stored
non-owningly, this type has no Drop, and every obligation below
extends to each Clone.
§Safety
bufmust be a live Objective-C object conforming toMTLBuffer. Null is rejected asInvalidHandleError::NullPointerand is not a caller obligation.row_pitchmust be the real row stride in bytes when the buffer carries image rows; consumers index rows by it, so an under-sized value reads a shifted image and an over-sized one runs off the end of[MTLBuffer length].- Refcount, lifetime,
registry_idand cross-thread obligations are exactly those ofMetalTextureHandle::try_from_raw: noretain, noDrop, the producer’s strong reference must outlive everyClone.
pub fn buffer(&self) -> *mut c_void
pub fn row_pitch(&self) -> u32
pub fn registry_id(&self) -> Option<u64>
pub fn keep_alive(&self) -> Option<&KeepAlive>
Trait Implementations§
Source§impl Clone for MetalBufferHandle
impl Clone for MetalBufferHandle
Source§impl Debug for MetalBufferHandle
impl Debug for MetalBufferHandle
impl Send for MetalBufferHandle
impl Sync for MetalBufferHandle
Auto Trait Implementations§
impl !RefUnwindSafe for MetalBufferHandle
impl !UnwindSafe for MetalBufferHandle
impl Freeze for MetalBufferHandle
impl Unpin for MetalBufferHandle
impl UnsafeUnpin for MetalBufferHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more