Expand description
Low-level Objective-C runtime bindings for Metal.
This crate provides the foundational FFI layer for communicating with the Objective-C runtime. It includes:
- Architecture-aware message sending (
objc_msgSendvariants) - Selector and class caching
- Objective-C block support (Clang ABI)
- Custom macros for enums and bitflags
§Safety
This crate is intentionally unsafe. All public functions are marked
unsafe and require the caller to uphold Objective-C runtime invariants.
Higher-level safe wrappers are provided by the metal crate.
Macros§
- class
- Cached class lookup.
- metal_
enum - Define a Metal enum type.
- metal_
options - Define a Metal options/bitflags type.
- sel
- Cached selector lookup.
Structs§
- Block
Literal - Block literal structure matching Clang’s Block_literal_1.
- Cached
Class - Helper type for caching classes.
- Cached
Sel - Helper type for caching selectors.
- Class
- Objective-C class.
- Heap
OneArg Block - A heap-allocated one-argument block that can be safely passed to ObjC APIs.
- Method
Description - Objective-C method description (for protocol methods).
- Protocol
- Objective-C protocol.
- RcBlock
- A reference-counted block wrapping a Rust closure.
- Sel
- Objective-C selector.
Enums§
- IOCompression
Method - IO compression method.
- IOCompression
Status - IO compression status.
Functions§
- MTLCopy
AllDevices ⚠ - Copy all available Metal devices.
- MTLCopy
AllDevices ⚠With Observer - Copy all devices with a notification observer.
- MTLCreate
System ⚠Default Device - Create the system default Metal device.
- MTLIO
Compression ⚠Context Append Data - Append data to a compression context.
- MTLIO
Compression ⚠Context Default Chunk Size - Get the default chunk size for IO compression.
- MTLIO
Create ⚠Compression Context - Create an IO compression context.
- MTLIO
Flush ⚠AndDestroy Compression Context - Flush and destroy a compression context.
- MTLRemove
Device ⚠Observer - Remove a device observer.
- copy_
all_ devices - Safely copy all available Metal devices (macOS only).
- create_
system_ default_ device - Safely create the system default Metal device.
- get_
protocol - Look up a protocol by name.
- io_
compression_ default_ chunk_ size - Get the default IO compression chunk size.
- msg_
send_ ⚠0 - Send a message with no arguments.
- msg_
send_ ⚠1 - Send a message with 1 argument.
- msg_
send_ ⚠2 - Send a message with 2 arguments.
- msg_
send_ ⚠3 - Send a message with 3 arguments.
- msg_
send_ ⚠4 - Send a message with 4 arguments.
- msg_
send_ ⚠5 - Send a message with 5 arguments.
- msg_
send_ ⚠6 - Send a message with 6 arguments.
- msg_
send_ ⚠7 - Send a message with 7 arguments.
- msg_
send_ ⚠8 - Send a message with 8 arguments.
- msg_
send_ ⚠9 - Send a message with 9 arguments.
- msg_
send_ ⚠10 - Send a message with 10 arguments.
Type Aliases§
- Command
Buffer Handler - Handler for command buffer completion.
- Deallocator
Block - Block type:
void (^)(void*, size_t) - Device
Notification Handler - Handler for device notifications.
- Device
Observer - Opaque type for device observers (used with hot-plug notifications).
- Drawable
Presented Handler - Handler for drawable presentation.
- Event
Block - Block type:
void (^)(id, uint64_t) - IOCompression
Context - Opaque compression context handle.
- LogHandler
Block - Block type:
void (^)(id, id, isize, id) - NewCompute
Pipeline State Completion Handler - Completion handler for compute pipeline state creation.
- NewCompute
Pipeline State With Reflection Completion Handler - Completion handler for compute pipeline state with reflection.
- NewLibrary
Completion Handler - Completion handler for library creation.
- NewRender
Pipeline State Completion Handler - Completion handler for render pipeline state creation.
- NewRender
Pipeline State With Reflection Completion Handler - Completion handler for render pipeline state with reflection.
- OneArg
Block - Block type:
void (^)(id) - Shared
Event Notification Handler - Handler for SharedEvent notifications.
- Three
ArgBlock - Block type:
void (^)(id, id, id) - TwoArg
Block - Block type:
void (^)(id, id) - Void
Block - Block type:
void (^)(void)