objc2_browser_engine_kit/generated/
BENetworkingProcess.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
10extern_class!(
11    /// An object that represents a running network extension process.
12    ///
13    /// The system guarantees that the extension process has launched by the time the initializer methods return.
14    /// If the extension process exits, the system calls ``interruptionHandler``. There can only be one extension process per
15    /// host browser. The first time this type is initialized, a  process will be launched. If a extension process is all ready
16    /// running, the returned object will represent the already running process.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/benetworkingprocess?language=objc)
19    #[unsafe(super(NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    pub struct BENetworkingProcess;
22);
23
24extern_conformance!(
25    unsafe impl NSObjectProtocol for BENetworkingProcess {}
26);
27
28impl BENetworkingProcess {
29    extern_methods!(
30        #[unsafe(method(init))]
31        #[unsafe(method_family = init)]
32        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
33
34        #[unsafe(method(new))]
35        #[unsafe(method_family = new)]
36        pub unsafe fn new() -> Retained<Self>;
37
38        #[cfg(feature = "block2")]
39        /// Asynchronously finds an existing network extension process or launches a one.
40        ///
41        /// This initializer finds an existing networking extension process. If it’s unable to find an
42        /// existing process, it launches a new extension process.
43        ///
44        /// - Parameters:
45        /// - `interruptionHandler` : A block that is called if the extension process terminates.
46        /// - `completion` : A block called with a new ``BENetworkingProcess`` when the extension process has
47        /// launched or with an error.
48        #[unsafe(method(networkProcessWithInterruptionHandler:completion:))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn networkProcessWithInterruptionHandler_completion(
51            interruption_handler: &block2::DynBlock<dyn Fn()>,
52            completion: &block2::DynBlock<dyn Fn(*mut BENetworkingProcess, *mut NSError)>,
53        );
54
55        #[cfg(feature = "block2")]
56        /// Asynchronously launches a network extension process.
57        ///
58        /// This initializer launches a new network extension process with the provided bundle identifier.
59        ///
60        /// - Parameters:
61        /// - `bundleID` : The bundle identifier of the network extension process to launch.
62        /// - `interruptionHandler` : A block that is called if the extension process terminates.
63        /// - `completion` : A block called with a new ``BENetworkingProcess`` when the extension process has
64        /// launched or with an error.
65        #[unsafe(method(networkProcessWithBundleID:interruptionHandler:completion:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn networkProcessWithBundleID_interruptionHandler_completion(
68            bundle_id: &NSString,
69            interruption_handler: &block2::DynBlock<dyn Fn()>,
70            completion: &block2::DynBlock<dyn Fn(*mut BENetworkingProcess, *mut NSError)>,
71        );
72
73        /// Stops the extension process.
74        ///
75        /// When you call this method, you tell the system your app no longer needs this extension process.
76        /// The system will terminate the extension process.
77        #[unsafe(method(invalidate))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn invalidate(&self);
80    );
81}