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/belayerhierarchyhandle?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct BELayerHierarchyHandle;
);

unsafe impl Send for BELayerHierarchyHandle {}

unsafe impl Sync for BELayerHierarchyHandle {}

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

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

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

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

        #[cfg(feature = "libc")]
        /// Decodes a handle 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(handleWithPort:data:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn handleWithPort_data_error(
            port: libc::mach_port_t,
            data: &NSData,
        ) -> Result<Retained<BELayerHierarchyHandle>, Retained<NSError>>;

        #[cfg(all(feature = "block2", feature = "libc"))]
        /// Encodes the handle 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 ``handleWithPort:data:error:``) will assume control of the right for you.
        /// - `copiedPort` will be `MACH_PORT_NULL` if the ``BELayerHierarchy`` pointed to by the handle is already invalidated.
        /// - The port and data should ultimately be consumed together  by ``handleWithPort: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>) + '_>,
        );
    );
}