MTLDrawable

Trait MTLDrawable 

Source
pub unsafe trait MTLDrawable: NSObjectProtocol {
    // Provided methods
    fn present(&self)
       where Self: Sized + Message { ... }
    fn presentAtTime(&self, presentation_time: CFTimeInterval)
       where Self: Sized + Message { ... }
    fn presentAfterMinimumDuration(&self, duration: CFTimeInterval)
       where Self: Sized + Message { ... }
    unsafe fn addPresentedHandler(&self, block: MTLDrawablePresentedHandler)
       where Self: Sized + Message { ... }
    fn presentedTime(&self) -> CFTimeInterval
       where Self: Sized + Message { ... }
    fn drawableID(&self) -> NSUInteger
       where Self: Sized + Message { ... }
}
Available on crate feature MTLDrawable only.
Expand description

All “drawable” objects (such as those coming from CAMetalLayer) are expected to conform to this protocol

See also Apple’s documentation

Provided Methods§

Source

fn present(&self)
where Self: Sized + Message,

Source

fn presentAtTime(&self, presentation_time: CFTimeInterval)
where Self: Sized + Message,

Available on crate feature objc2-core-foundation only.
Source

fn presentAfterMinimumDuration(&self, duration: CFTimeInterval)
where Self: Sized + Message,

Available on crate feature objc2-core-foundation only.

Present this drawable while setting a minimum duration in seconds before allowing this drawable to appear on the display.

Parameter duration: Duration in seconds before this drawable is allowed to appear on the display

Source

unsafe fn addPresentedHandler(&self, block: MTLDrawablePresentedHandler)
where Self: Sized + Message,

Available on crate feature block2 only.

Add a block to be called when this drawable is presented on screen.

§Safety

block must be a valid pointer.

Source

fn presentedTime(&self) -> CFTimeInterval
where Self: Sized + Message,

Available on crate feature objc2-core-foundation only.

The host time that this drawable was presented on screen.

Returns 0 if a frame has not been presented or has been skipped.

Source

fn drawableID(&self) -> NSUInteger
where Self: Sized + Message,

The monotonically incremented ID for all MTLDrawable objects created from the same CAMetalLayer object.

The value starts from 0.

Trait Implementations§

Source§

impl ProtocolType for dyn MTLDrawable

Source§

const NAME: &'static str = "MTLDrawable"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn MTLDrawable
where T: ?Sized + Message + MTLDrawable,

Implementations on Foreign Types§

Source§

impl<T> MTLDrawable for ProtocolObject<T>
where T: ?Sized + MTLDrawable,

Implementors§