objc2-web-kit 0.3.2

Bindings to the WebKit 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/webkit/wkcontentruleliststore?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct WKContentRuleListStore;
);

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

impl WKContentRuleListStore {
    extern_methods!(
        #[unsafe(method(defaultStore))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultStore(mtm: MainThreadMarker) -> Option<Retained<Self>>;

        /// # Safety
        ///
        /// `url` might not allow `None`.
        #[unsafe(method(storeWithURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn storeWithURL(
            url: Option<&NSURL>,
            mtm: MainThreadMarker,
        ) -> Option<Retained<Self>>;

        #[cfg(all(feature = "WKContentRuleList", feature = "block2"))]
        /// # Safety
        ///
        /// - `identifier` might not allow `None`.
        /// - `encoded_content_rule_list` might not allow `None`.
        /// - `completion_handler` might not allow `None`.
        #[unsafe(method(compileContentRuleListForIdentifier:encodedContentRuleList:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn compileContentRuleListForIdentifier_encodedContentRuleList_completionHandler(
            &self,
            identifier: Option<&NSString>,
            encoded_content_rule_list: Option<&NSString>,
            completion_handler: Option<
                &block2::DynBlock<dyn Fn(*mut WKContentRuleList, *mut NSError)>,
            >,
        );

        #[cfg(all(feature = "WKContentRuleList", feature = "block2"))]
        /// # Safety
        ///
        /// - `identifier` might not allow `None`.
        /// - `completion_handler` might not allow `None`.
        #[unsafe(method(lookUpContentRuleListForIdentifier:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn lookUpContentRuleListForIdentifier_completionHandler(
            &self,
            identifier: Option<&NSString>,
            completion_handler: Option<
                &block2::DynBlock<dyn Fn(*mut WKContentRuleList, *mut NSError)>,
            >,
        );

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// - `identifier` might not allow `None`.
        /// - `completion_handler` might not allow `None`.
        #[unsafe(method(removeContentRuleListForIdentifier:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeContentRuleListForIdentifier_completionHandler(
            &self,
            identifier: Option<&NSString>,
            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `completion_handler` might not allow `None`.
        #[unsafe(method(getAvailableContentRuleListIdentifiers:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getAvailableContentRuleListIdentifiers(
            &self,
            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSArray<NSString>)>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl WKContentRuleListStore {
    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(mtm: MainThreadMarker) -> Retained<Self>;
    );
}