pub struct IONotificationPort { /* private fields */ }Expand description
Implementations§
Source§impl IONotificationPort
impl IONotificationPort
Sourcepub fn create(main_port: mach_port_t) -> IONotificationPortRef
Available on crate feature libc only.
pub fn create(main_port: mach_port_t) -> IONotificationPortRef
libc only.Creates and returns a notification object for receiving IOKit notifications of new devices or state changes.
Creates the notification object to receive notifications from IOKit of new device arrivals or state changes. The notification object can be supply a CFRunLoopSource, or mach_port_t to be used to listen for events.
Parameter mainPort: The main port obtained from IOMainPort(). Pass kIOMainPortDefault to look up the default main port.
Returns: A reference to the notification object.
Sourcepub unsafe fn destroy(notify: IONotificationPortRef)
pub unsafe fn destroy(notify: IONotificationPortRef)
Destroys a notification object created with IONotificationPortCreate.
Also destroys any mach_port’s or CFRunLoopSources obtained from
IONotificationPortGetRunLoopSource
IONotificationPortGetMachPort
Parameter notify: A reference to the notification object.
§Safety
notify must be a valid pointer.
Sourcepub unsafe fn run_loop_source(
notify: IONotificationPortRef,
) -> Option<CFRetained<CFRunLoopSource>>
pub unsafe fn run_loop_source( notify: IONotificationPortRef, ) -> Option<CFRetained<CFRunLoopSource>>
Returns a CFRunLoopSource to be used to listen for notifications.
A notification object may deliver notifications to a CFRunLoop by adding the run loop source returned by this function to the run loop.
The caller should not release this CFRunLoopSource. Just call
IONotificationPortDestroyParameter notify: The notification object.
Returns: A CFRunLoopSourceRef for the notification object.
§Safety
notify must be a valid pointer.
Sourcepub unsafe fn mach_port(notify: IONotificationPortRef) -> mach_port_t
Available on crate feature libc only.
pub unsafe fn mach_port(notify: IONotificationPortRef) -> mach_port_t
libc only.Returns a mach_port to be used to listen for notifications.
A notification object may deliver notifications to a mach messaging client if they listen for messages on the port obtained from this function. Callbacks associated with the notifications may be delivered by calling IODispatchCalloutFromMessage with messages received.
The caller should not release this mach_port_t. Just call
IONotificationPortDestroyParameter notify: The notification object.
Returns: A mach_port for the notification object.
§Safety
notify must be a valid pointer.
Sourcepub unsafe fn set_importance_receiver(
notify: IONotificationPortRef,
) -> kern_return_t
Available on crate feature libc only.
pub unsafe fn set_importance_receiver( notify: IONotificationPortRef, ) -> kern_return_t
libc only.Configure a notification port to be an importance receiver.
Sets the MACH_PORT_IMPORTANCE_RECEIVER attribute on the underlying mach port. Importance-donating messages sent to a notification port with this attribute enabled will boost the importance of the receiving process for the duration of the notification handler.
Parameter notify: The notification object.
Returns: A kern_return_t error code.
§Safety
notify must be a valid pointer.
Sourcepub unsafe fn set_dispatch_queue(
notify: IONotificationPortRef,
queue: Option<&DispatchQueue>,
)
Available on crate feature dispatch2 only.
pub unsafe fn set_dispatch_queue( notify: IONotificationPortRef, queue: Option<&DispatchQueue>, )
dispatch2 only.Sets a dispatch queue to be used to listen for notifications.
A notification object may deliver notifications to a dispatch client.
Parameter notify: The notification object.
Parameter queue: A dispatch queue.
§Safety
notifymust be a valid pointer.queuepossibly has additional threading requirements.queuemight not allowNone.
Trait Implementations§
Source§impl Debug for IONotificationPort
impl Debug for IONotificationPort
Source§impl RefEncode for IONotificationPort
Available on crate feature objc2 only.
impl RefEncode for IONotificationPort
objc2 only.