objc2-browser-engine-kit 0.3.2

Bindings to the BrowserEngineKit 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/browserenginekit/belayerhierarchyhostingtransactioncoordinator?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct BELayerHierarchyHostingTransactionCoordinator;
);

unsafe impl Send for BELayerHierarchyHostingTransactionCoordinator {}

unsafe impl Sync for BELayerHierarchyHostingTransactionCoordinator {}

extern_conformance!(
    unsafe impl NSCoding for BELayerHierarchyHostingTransactionCoordinator {}
);

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

extern_conformance!(
    unsafe impl NSSecureCoding for BELayerHierarchyHostingTransactionCoordinator {}
);

impl BELayerHierarchyHostingTransactionCoordinator {
    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>;

        /// may fail if a connection to the render server cannot be established
        #[unsafe(method(coordinatorWithError:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn coordinatorWithError(
        ) -> Result<Retained<BELayerHierarchyHostingTransactionCoordinator>, Retained<NSError>>;

        #[cfg(feature = "BELayerHierarchy")]
        /// a signal to coordinate transactions involving `layerHierarchy` from now until `commit` is called
        #[unsafe(method(addLayerHierarchy:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addLayerHierarchy(&self, layer_hierarchy: &BELayerHierarchy);

        #[cfg(feature = "BELayerHierarchyHostingView")]
        /// a signal to coordinate transactions involving `hostingView` from now until `commit` is called
        #[unsafe(method(addLayerHierarchyHostingView:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addLayerHierarchyHostingView(
            &self,
            hosting_view: &BELayerHierarchyHostingView,
        );

        /// `commit` must be called on _every_ instance and it must be the last call to each instance.
        /// note that it does not commit `CATransaction`s but rather commits the coordination of transactions in the render server.
        /// note that coordinators should have as constrained a lifespan as possible and will timeout if held open too long.
        #[unsafe(method(commit))]
        #[unsafe(method_family = none)]
        pub unsafe fn commit(&self, mtm: MainThreadMarker);

        #[cfg(feature = "libc")]
        /// Decodes a coordinator form a `mach_port_t` send right and its accompanying metadata.
        /// - This method takes ownership of the port right (even if it returns an error).
        #[unsafe(method(coordinatorWithPort:data:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn coordinatorWithPort_data_error(
            port: libc::mach_port_t,
            data: &NSData,
        ) -> Result<Retained<BELayerHierarchyHostingTransactionCoordinator>, Retained<NSError>>;

        #[cfg(all(feature = "block2", feature = "libc"))]
        /// Encodes the coordinator into a `mach_port_t` send right and its accompanying metadata.
        /// - The block is responsible for disposing of `copiedPort` - failure to manage its lifecycle will leak the port. Note that some functions (like ``coordinatorWithPort:data:error:``) will assume control of the right for you.
        /// - `copiedPort` will be `MACH_PORT_NULL` if the receiver is already invalidated.
        /// - The port and data should ultimately be consumed together and _only_ once by ``coordinatorWithPort:data:error:``.
        #[unsafe(method(encodeWithBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn encodeWithBlock(
            &self,
            block: &block2::DynBlock<dyn Fn(libc::mach_port_t, NonNull<NSData>) + '_>,
        );
    );
}