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::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// The platform configuration for a generic Intel or ARM virtual machine.
    ///
    /// When a virtual machine is saved to disk then loaded again, the `machineIdentifier`
    /// must be restored to the original value.
    ///
    /// If multiple virtual machines are created from the same configuration, each should have a unique `machineIdentifier`.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzgenericplatformconfiguration?language=objc)
    #[unsafe(super(VZPlatformConfiguration, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "VZPlatformConfiguration")]
    pub struct VZGenericPlatformConfiguration;
);

#[cfg(feature = "VZPlatformConfiguration")]
extern_conformance!(
    unsafe impl NSCopying for VZGenericPlatformConfiguration {}
);

#[cfg(feature = "VZPlatformConfiguration")]
unsafe impl CopyingHelper for VZGenericPlatformConfiguration {
    type Result = Self;
}

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

#[cfg(feature = "VZPlatformConfiguration")]
impl VZGenericPlatformConfiguration {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "VZGenericMachineIdentifier")]
        /// The unique machine identifier.
        ///
        /// Running two virtual machines concurrently with the same identifier results in undefined behavior
        /// in the guest operating system. When restoring a virtual machine from saved state, this
        /// `machineIdentifier` must match the `machineIdentifier` of the saved virtual machine.
        #[unsafe(method(machineIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn machineIdentifier(&self) -> Retained<VZGenericMachineIdentifier>;

        #[cfg(feature = "VZGenericMachineIdentifier")]
        /// Setter for [`machineIdentifier`][Self::machineIdentifier].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setMachineIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMachineIdentifier(&self, machine_identifier: &VZGenericMachineIdentifier);

        /// Indicate whether or not nested virtualization is available.
        ///
        /// Nested virtualization is only available on some hardware and software configurations. It may also be disabled by policy.
        ///
        /// Use this property to check if support is available for the platform. If nested virtualization is supported,
        /// use `nestedVirtualizationEnabled` to enable the feature.
        ///
        /// See: nestedVirtualizationEnabled.
        #[unsafe(method(isNestedVirtualizationSupported))]
        #[unsafe(method_family = none)]
        pub unsafe fn isNestedVirtualizationSupported() -> bool;

        /// Enable nested virtualization for the platform.
        ///
        /// If nested virtualization is available, enable it for the current platform configuration.
        ///
        /// You can use `nestedVirtualizationSupported` to discover the nested virtualization availability before enabling it.
        ///
        /// The default value is NO, nested virtualization is disabled.
        ///
        /// See: nestedVirtualizationSupported.
        #[unsafe(method(isNestedVirtualizationEnabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isNestedVirtualizationEnabled(&self) -> bool;

        /// Setter for [`isNestedVirtualizationEnabled`][Self::isNestedVirtualizationEnabled].
        #[unsafe(method(setNestedVirtualizationEnabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setNestedVirtualizationEnabled(&self, nested_virtualization_enabled: bool);
    );
}

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