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
51unsafe impl NSObjectProtocol for AVCustomRoutingEvent {}
52
53impl AVCustomRoutingEvent {
54    extern_methods!(
55        /// A reason for an event, such as a user request to activate or deactivate a
56        /// route.
57        #[unsafe(method(reason))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn reason(&self) -> AVCustomRoutingEventReason;
60
61        #[cfg(feature = "AVCustomDeviceRoute")]
62        /// A route for the event.
63        #[unsafe(method(route))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn route(&self) -> Retained<AVCustomDeviceRoute>;
66    );
67}
68
69/// Methods declared on superclass `NSObject`.
70impl AVCustomRoutingEvent {
71    extern_methods!(
72        #[unsafe(method(init))]
73        #[unsafe(method_family = init)]
74        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
75
76        #[unsafe(method(new))]
77        #[unsafe(method_family = new)]
78        pub unsafe fn new() -> Retained<Self>;
79    );
80}