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!(
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hksourcequery?language=objc)
    #[unsafe(super(HKQuery, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "HKQuery")]
    pub struct HKSourceQuery;
);

#[cfg(feature = "HKQuery")]
unsafe impl Send for HKSourceQuery {}

#[cfg(feature = "HKQuery")]
unsafe impl Sync for HKSourceQuery {}

#[cfg(feature = "HKQuery")]
extern_conformance!(
    unsafe impl NSObjectProtocol for HKSourceQuery {}
);

#[cfg(feature = "HKQuery")]
impl HKSourceQuery {
    extern_methods!(
        #[cfg(all(feature = "HKObjectType", feature = "HKSource", feature = "block2"))]
        /// Returns a query that will retrieve HKSources that have saved samples of the given type matching the
        /// given predicate.
        ///
        ///
        /// Parameter `sampleType`: The type of sample.
        ///
        /// Parameter `objectPredicate`: The predicate which samples must match.
        ///
        /// Parameter `completionHandler`: The block to be called when the query has finished executing.
        ///
        /// # Safety
        ///
        /// `completion_handler` block must be sendable.
        #[unsafe(method(initWithSampleType:samplePredicate:completionHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSampleType_samplePredicate_completionHandler(
            this: Allocated<Self>,
            sample_type: &HKSampleType,
            object_predicate: Option<&NSPredicate>,
            completion_handler: &block2::DynBlock<
                dyn Fn(NonNull<HKSourceQuery>, *mut NSSet<HKSource>, *mut NSError),
            >,
        ) -> Retained<Self>;
    );
}

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

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