objc2-virtualization 0.3.2

Bindings to the Virtualization framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// Network device attachment bridging a host physical interface with a virtual network device.
    ///
    /// A bridged network allows the virtual machine to use the same physical interface as the host. Both host and virtual machine
    /// send and receive packets on the same physical interface but have distinct network layers.
    ///
    /// The bridge network device attachment is used with a VZNetworkDeviceConfiguration to define a virtual network device.
    ///
    /// Using a VZBridgedNetworkDeviceAttachment requires the app to have the "com.apple.vm.networking" entitlement.
    ///
    ///
    /// See: VZBridgedNetworkInterface
    ///
    /// See: VZNetworkDeviceConfiguration
    ///
    /// See: VZVirtioNetworkDeviceConfiguration
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzbridgednetworkdeviceattachment?language=objc)
    #[unsafe(super(VZNetworkDeviceAttachment, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "VZNetworkDeviceAttachment")]
    pub struct VZBridgedNetworkDeviceAttachment;
);

#[cfg(feature = "VZNetworkDeviceAttachment")]
extern_conformance!(
    unsafe impl NSObjectProtocol for VZBridgedNetworkDeviceAttachment {}
);

#[cfg(feature = "VZNetworkDeviceAttachment")]
impl VZBridgedNetworkDeviceAttachment {
    extern_methods!(
        #[cfg(feature = "VZBridgedNetworkInterface")]
        /// Initialize a VZBridgedNetworkDeviceAttachment with a host network interface.
        ///
        /// Parameter `interface`: Host network interface controller.
        #[unsafe(method(initWithInterface:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithInterface(
            this: Allocated<Self>,
            interface: &VZBridgedNetworkInterface,
        ) -> Retained<Self>;

        #[cfg(feature = "VZBridgedNetworkInterface")]
        /// Network interface of this device attachment.
        #[unsafe(method(interface))]
        #[unsafe(method_family = none)]
        pub unsafe fn interface(&self) -> Retained<VZBridgedNetworkInterface>;
    );
}

/// Methods declared on superclass `VZNetworkDeviceAttachment`.
#[cfg(feature = "VZNetworkDeviceAttachment")]
impl VZBridgedNetworkDeviceAttachment {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}