objc2-map-kit 0.3.2

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

/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mkdirectionshandler?language=objc)
#[cfg(all(feature = "MKDirectionsResponse", feature = "block2"))]
pub type MKDirectionsHandler =
    *mut block2::DynBlock<dyn Fn(*mut MKDirectionsResponse, *mut NSError)>;

/// [Apple's documentation](https://developer.apple.com/documentation/mapkit/mketahandler?language=objc)
#[cfg(all(feature = "MKDirectionsResponse", feature = "block2"))]
pub type MKETAHandler = *mut block2::DynBlock<dyn Fn(*mut MKETAResponse, *mut NSError)>;

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

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

impl MKDirections {
    extern_methods!(
        #[cfg(feature = "MKDirectionsRequest")]
        #[unsafe(method(initWithRequest:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRequest(
            this: Allocated<Self>,
            request: &MKDirectionsRequest,
        ) -> Retained<Self>;

        #[cfg(all(feature = "MKDirectionsResponse", feature = "block2"))]
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer.
        #[unsafe(method(calculateDirectionsWithCompletionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn calculateDirectionsWithCompletionHandler(
            &self,
            completion_handler: MKDirectionsHandler,
        );

        #[cfg(all(feature = "MKDirectionsResponse", feature = "block2"))]
        /// # Safety
        ///
        /// `completion_handler` must be a valid pointer.
        #[unsafe(method(calculateETAWithCompletionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn calculateETAWithCompletionHandler(&self, completion_handler: MKETAHandler);

        #[unsafe(method(cancel))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancel(&self);

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

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