objc2-health-kit 0.3.2

Bindings to the HealthKit 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 objc2_foundation::*;

use crate::*;

extern_class!(
    /// The HKQuantity class provides an encapsulation of a quantity value and the unit of measurement.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkquantity?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct HKQuantity;
);

unsafe impl Send for HKQuantity {}

unsafe impl Sync for HKQuantity {}

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

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

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

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

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

impl HKQuantity {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "HKUnit")]
        /// Returns a new object representing a quantity measurement with the given unit.
        #[unsafe(method(quantityWithUnit:doubleValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn quantityWithUnit_doubleValue(
            unit: &HKUnit,
            value: c_double,
        ) -> Retained<Self>;

        #[cfg(feature = "HKUnit")]
        /// Returns yes if the receiver's value can be converted to a value of the given unit.
        #[unsafe(method(isCompatibleWithUnit:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isCompatibleWithUnit(&self, unit: &HKUnit) -> bool;

        #[cfg(feature = "HKUnit")]
        /// Returns the quantity value converted to the given unit.
        ///
        /// Throws an exception if the receiver's value cannot be converted to one of the requested unit.
        #[unsafe(method(doubleValueForUnit:))]
        #[unsafe(method_family = none)]
        pub unsafe fn doubleValueForUnit(&self, unit: &HKUnit) -> c_double;

        /// Returns an NSComparisonResult value that indicates whether the receiver is greater than, equal to, or
        /// less than a given quantity.
        ///
        /// Throws an exception if the unit of the given quantity is not compatible with the receiver's unit.
        #[unsafe(method(compare:))]
        #[unsafe(method_family = none)]
        pub unsafe fn compare(&self, quantity: &HKQuantity) -> NSComparisonResult;
    );
}

/// Methods declared on superclass `NSObject`.
impl HKQuantity {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}