objc2_core_telephony/generated/
CTCellularData.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/coretelephony/ctcellulardatarestrictedstate?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct CTCellularDataRestrictedState(pub NSUInteger);
14impl CTCellularDataRestrictedState {
15    #[doc(alias = "kCTCellularDataRestrictedStateUnknown")]
16    pub const RestrictedStateUnknown: Self = Self(0);
17    #[doc(alias = "kCTCellularDataRestricted")]
18    pub const Restricted: Self = Self(1);
19    #[doc(alias = "kCTCellularDataNotRestricted")]
20    pub const NotRestricted: Self = Self(2);
21}
22
23unsafe impl Encode for CTCellularDataRestrictedState {
24    const ENCODING: Encoding = NSUInteger::ENCODING;
25}
26
27unsafe impl RefEncode for CTCellularDataRestrictedState {
28    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
29}
30
31/// [Apple's documentation](https://developer.apple.com/documentation/coretelephony/cellulardatarestrictiondidupdatenotifier?language=objc)
32#[cfg(feature = "block2")]
33pub type CellularDataRestrictionDidUpdateNotifier =
34    *mut block2::DynBlock<dyn Fn(CTCellularDataRestrictedState)>;
35
36extern_class!(
37    /// [Apple's documentation](https://developer.apple.com/documentation/coretelephony/ctcellulardata?language=objc)
38    #[unsafe(super(NSObject))]
39    #[derive(Debug, PartialEq, Eq, Hash)]
40    pub struct CTCellularData;
41);
42
43extern_conformance!(
44    unsafe impl NSObjectProtocol for CTCellularData {}
45);
46
47impl CTCellularData {
48    extern_methods!(
49        #[cfg(feature = "block2")]
50        #[unsafe(method(cellularDataRestrictionDidUpdateNotifier))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn cellularDataRestrictionDidUpdateNotifier(
53            &self,
54        ) -> CellularDataRestrictionDidUpdateNotifier;
55
56        #[cfg(feature = "block2")]
57        /// Setter for [`cellularDataRestrictionDidUpdateNotifier`][Self::cellularDataRestrictionDidUpdateNotifier].
58        ///
59        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
60        ///
61        /// # Safety
62        ///
63        /// `cellular_data_restriction_did_update_notifier` must be a valid pointer or null.
64        #[unsafe(method(setCellularDataRestrictionDidUpdateNotifier:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn setCellularDataRestrictionDidUpdateNotifier(
67            &self,
68            cellular_data_restriction_did_update_notifier: CellularDataRestrictionDidUpdateNotifier,
69        );
70
71        #[unsafe(method(restrictedState))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn restrictedState(&self) -> CTCellularDataRestrictedState;
74    );
75}
76
77/// Methods declared on superclass `NSObject`.
78impl CTCellularData {
79    extern_methods!(
80        #[unsafe(method(init))]
81        #[unsafe(method_family = init)]
82        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
83
84        #[unsafe(method(new))]
85        #[unsafe(method_family = new)]
86        pub unsafe fn new() -> Retained<Self>;
87    );
88}