objc2_av_routing/generated/
AVCustomRoutingEvent.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8/// Values that indicate the reason for a routing event.
9///
10/// See also [Apple's documentation](https://developer.apple.com/documentation/avrouting/avcustomroutingeventreason?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct AVCustomRoutingEventReason(pub NSInteger);
15impl AVCustomRoutingEventReason {
16    /// A value that indicates that a user selects a route in the picker.
17    #[doc(alias = "AVCustomRoutingEventReasonActivate")]
18    pub const Activate: Self = Self(0);
19    /// A value that indicates that a user deselects a route in the picker.
20    #[doc(alias = "AVCustomRoutingEventReasonDeactivate")]
21    pub const Deactivate: Self = Self(1);
22    /// A value that indicates to reactivate a route a user authorized previously.
23    #[doc(alias = "AVCustomRoutingEventReasonReactivate")]
24    pub const Reactivate: Self = Self(2);
25}
26
27unsafe impl Encode for AVCustomRoutingEventReason {
28    const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for AVCustomRoutingEventReason {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36    /// An object that represents an event that occurs on a route.
37    ///
38    /// Depending on the route’s reason, apps establish or tear down a connection to
39    /// a specified route.
40    ///
41    /// See also [Apple's documentation](https://developer.apple.com/documentation/avrouting/avcustomroutingevent?language=objc)
42    #[unsafe(super(NSObject))]
43    #[derive(Debug, PartialEq, Eq, Hash)]
44    pub struct AVCustomRoutingEvent;
45);
46
47unsafe impl Send for AVCustomRoutingEvent {}
48
49unsafe impl Sync for AVCustomRoutingEvent {}
50
51extern_conformance!(
52    unsafe impl NSObjectProtocol for AVCustomRoutingEvent {}
53);
54
55impl AVCustomRoutingEvent {
56    extern_methods!(
57        /// A reason for an event, such as a user request to activate or deactivate a
58        /// route.
59        ///
60        /// This property is not atomic.
61        ///
62        /// # Safety
63        ///
64        /// This might not be thread-safe.
65        #[unsafe(method(reason))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn reason(&self) -> AVCustomRoutingEventReason;
68
69        #[cfg(feature = "AVCustomDeviceRoute")]
70        /// A route for the event.
71        ///
72        /// This property is not atomic.
73        ///
74        /// # Safety
75        ///
76        /// This might not be thread-safe.
77        #[unsafe(method(route))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn route(&self) -> Retained<AVCustomDeviceRoute>;
80    );
81}
82
83/// Methods declared on superclass `NSObject`.
84impl AVCustomRoutingEvent {
85    extern_methods!(
86        #[unsafe(method(init))]
87        #[unsafe(method_family = init)]
88        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
89
90        #[unsafe(method(new))]
91        #[unsafe(method_family = new)]
92        pub unsafe fn new() -> Retained<Self>;
93    );
94}