objc2_core_motion/generated/
CMStepCounter.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmstepqueryhandler?language=objc)
11#[cfg(feature = "block2")]
12pub type CMStepQueryHandler = *mut block2::DynBlock<dyn Fn(NSInteger, *mut NSError)>;
13
14/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmstepupdatehandler?language=objc)
15#[cfg(feature = "block2")]
16pub type CMStepUpdateHandler =
17    *mut block2::DynBlock<dyn Fn(NSInteger, NonNull<NSDate>, *mut NSError)>;
18
19extern_class!(
20    /// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmstepcounter?language=objc)
21    #[unsafe(super(NSObject))]
22    #[derive(Debug, PartialEq, Eq, Hash)]
23    pub struct CMStepCounter;
24);
25
26extern_conformance!(
27    unsafe impl NSObjectProtocol for CMStepCounter {}
28);
29
30impl CMStepCounter {
31    extern_methods!(
32        #[unsafe(method(isStepCountingAvailable))]
33        #[unsafe(method_family = none)]
34        pub unsafe fn isStepCountingAvailable() -> bool;
35
36        #[cfg(feature = "block2")]
37        /// # Safety
38        ///
39        /// - `queue` possibly has additional threading requirements.
40        /// - `handler` must be a valid pointer.
41        #[unsafe(method(queryStepCountStartingFrom:to:toQueue:withHandler:))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn queryStepCountStartingFrom_to_toQueue_withHandler(
44            &self,
45            start: &NSDate,
46            end: &NSDate,
47            queue: &NSOperationQueue,
48            handler: CMStepQueryHandler,
49        );
50
51        #[cfg(feature = "block2")]
52        /// # Safety
53        ///
54        /// - `queue` possibly has additional threading requirements.
55        /// - `handler` must be a valid pointer.
56        #[unsafe(method(startStepCountingUpdatesToQueue:updateOn:withHandler:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn startStepCountingUpdatesToQueue_updateOn_withHandler(
59            &self,
60            queue: &NSOperationQueue,
61            step_counts: NSInteger,
62            handler: CMStepUpdateHandler,
63        );
64
65        #[unsafe(method(stopStepCountingUpdates))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn stopStepCountingUpdates(&self);
68    );
69}
70
71/// Methods declared on superclass `NSObject`.
72impl CMStepCounter {
73    extern_methods!(
74        #[unsafe(method(init))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
77
78        #[unsafe(method(new))]
79        #[unsafe(method_family = new)]
80        pub unsafe fn new() -> Retained<Self>;
81    );
82}