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 booting macOS on Apple Silicon.
    ///
    /// When creating a virtual machine from scratch, the `hardwareModel` and `auxiliaryStorage` depend on the restore image
    /// that will be used to install macOS.
    ///
    /// To choose the hardware model, start from VZMacOSRestoreImage.mostFeaturefulSupportedConfiguration to get a supported configuration, then
    /// use its VZMacOSConfigurationRequirements.hardwareModel property to get the hardware model.
    /// Use the hardware model to set up VZMacPlatformConfiguration and to initialize a new auxiliary storage with
    /// -[VZMacAuxiliaryStorage initCreatingStorageAtURL:hardwareModel:options:error:].
    ///
    /// When a virtual machine is saved to disk then loaded again, the `hardwareModel`, `machineIdentifier` and `auxiliaryStorage`
    /// must be restored to their original values.
    ///
    /// If multiple virtual machines are created from the same configuration, each should have a unique  `auxiliaryStorage` and `machineIdentifier`.
    ///
    /// See also: VZMacOSRestoreImage
    ///
    /// See also: VZMacOSConfigurationRequirements
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzmacplatformconfiguration?language=objc)
    #[unsafe(super(VZPlatformConfiguration, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "VZPlatformConfiguration")]
    pub struct VZMacPlatformConfiguration;
);

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

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

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

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

        #[cfg(feature = "VZMacHardwareModel")]
        /// The Mac hardware model.
        #[unsafe(method(hardwareModel))]
        #[unsafe(method_family = none)]
        pub unsafe fn hardwareModel(&self) -> Retained<VZMacHardwareModel>;

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

        #[cfg(feature = "VZMacMachineIdentifier")]
        /// The unique Mac machine identifier.
        ///
        /// Running two virtual machines concurrently with the same identifier results in undefined behavior in the guest operating system.
        #[unsafe(method(machineIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn machineIdentifier(&self) -> Retained<VZMacMachineIdentifier>;

        #[cfg(feature = "VZMacMachineIdentifier")]
        /// 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: &VZMacMachineIdentifier);

        #[cfg(feature = "VZMacAuxiliaryStorage")]
        /// The Mac auxiliary storage.
        ///
        /// When creating a virtual machine from scratch, the hardware model of the `auxiliaryStorage` must match the hardware model of
        /// the `hardwareModel` property.
        #[unsafe(method(auxiliaryStorage))]
        #[unsafe(method_family = none)]
        pub unsafe fn auxiliaryStorage(&self) -> Option<Retained<VZMacAuxiliaryStorage>>;

        #[cfg(feature = "VZMacAuxiliaryStorage")]
        /// Setter for [`auxiliaryStorage`][Self::auxiliaryStorage].
        #[unsafe(method(setAuxiliaryStorage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAuxiliaryStorage(&self, auxiliary_storage: Option<&VZMacAuxiliaryStorage>);
    );
}

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