objc2-core-telephony 0.3.2

Bindings to the CoreTelephony framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coretelephony/ctcellulardatarestrictedstate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CTCellularDataRestrictedState(pub NSUInteger);
impl CTCellularDataRestrictedState {
    #[doc(alias = "kCTCellularDataRestrictedStateUnknown")]
    pub const RestrictedStateUnknown: Self = Self(0);
    #[doc(alias = "kCTCellularDataRestricted")]
    pub const Restricted: Self = Self(1);
    #[doc(alias = "kCTCellularDataNotRestricted")]
    pub const NotRestricted: Self = Self(2);
}

unsafe impl Encode for CTCellularDataRestrictedState {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for CTCellularDataRestrictedState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coretelephony/cellulardatarestrictiondidupdatenotifier?language=objc)
#[cfg(feature = "block2")]
pub type CellularDataRestrictionDidUpdateNotifier =
    *mut block2::DynBlock<dyn Fn(CTCellularDataRestrictedState)>;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/coretelephony/ctcellulardata?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CTCellularData;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for CTCellularData {}
);

impl CTCellularData {
    extern_methods!(
        #[cfg(feature = "block2")]
        #[unsafe(method(cellularDataRestrictionDidUpdateNotifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn cellularDataRestrictionDidUpdateNotifier(
            &self,
        ) -> CellularDataRestrictionDidUpdateNotifier;

        #[cfg(feature = "block2")]
        /// Setter for [`cellularDataRestrictionDidUpdateNotifier`][Self::cellularDataRestrictionDidUpdateNotifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `cellular_data_restriction_did_update_notifier` must be a valid pointer or null.
        #[unsafe(method(setCellularDataRestrictionDidUpdateNotifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCellularDataRestrictionDidUpdateNotifier(
            &self,
            cellular_data_restriction_did_update_notifier: CellularDataRestrictionDidUpdateNotifier,
        );

        #[unsafe(method(restrictedState))]
        #[unsafe(method_family = none)]
        pub unsafe fn restrictedState(&self) -> CTCellularDataRestrictedState;
    );
}

/// Methods declared on superclass `NSObject`.
impl CTCellularData {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}