objc2-core-motion 0.3.2

Bindings to the CoreMotion framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-location")]
use objc2_core_location::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmodometerorigindevice?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CMOdometerOriginDevice(pub NSInteger);
impl CMOdometerOriginDevice {
    #[doc(alias = "CMOdometerOriginDeviceUnknown")]
    pub const Unknown: Self = Self(0);
    #[doc(alias = "CMOdometerOriginDeviceLocal")]
    pub const Local: Self = Self(1);
    #[doc(alias = "CMOdometerOriginDeviceRemote")]
    pub const Remote: Self = Self(2);
}

unsafe impl Encode for CMOdometerOriginDevice {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

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

unsafe impl Send for CMOdometerData {}

unsafe impl Sync for CMOdometerData {}

extern_conformance!(
    unsafe impl NSCoding for CMOdometerData {}
);

extern_conformance!(
    unsafe impl NSCopying for CMOdometerData {}
);

unsafe impl CopyingHelper for CMOdometerData {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for CMOdometerData {}
);

impl CMOdometerData {
    extern_methods!(
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(startDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn startDate(&self) -> Retained<NSDate>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(endDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn endDate(&self) -> Retained<NSDate>;

        #[cfg(feature = "objc2-core-location")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(deltaDistance))]
        #[unsafe(method_family = none)]
        pub unsafe fn deltaDistance(&self) -> CLLocationDistance;

        #[cfg(feature = "objc2-core-location")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(deltaDistanceAccuracy))]
        #[unsafe(method_family = none)]
        pub unsafe fn deltaDistanceAccuracy(&self) -> CLLocationAccuracy;

        #[cfg(feature = "objc2-core-location")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(speed))]
        #[unsafe(method_family = none)]
        pub unsafe fn speed(&self) -> CLLocationSpeed;

        #[cfg(feature = "objc2-core-location")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(speedAccuracy))]
        #[unsafe(method_family = none)]
        pub unsafe fn speedAccuracy(&self) -> CLLocationSpeedAccuracy;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(gpsDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn gpsDate(&self) -> Retained<NSDate>;

        #[cfg(feature = "objc2-core-location")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(deltaAltitude))]
        #[unsafe(method_family = none)]
        pub unsafe fn deltaAltitude(&self) -> CLLocationDistance;

        #[cfg(feature = "objc2-core-location")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(verticalAccuracy))]
        #[unsafe(method_family = none)]
        pub unsafe fn verticalAccuracy(&self) -> CLLocationAccuracy;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(originDevice))]
        #[unsafe(method_family = none)]
        pub unsafe fn originDevice(&self) -> CMOdometerOriginDevice;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(slope))]
        #[unsafe(method_family = none)]
        pub unsafe fn slope(&self) -> Option<Retained<NSNumber>>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(maxAbsSlope))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxAbsSlope(&self) -> Option<Retained<NSNumber>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl CMOdometerData {
    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>;
    );
}