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 objc2_foundation::*;

use crate::*;

extern_class!(
    /// An identifier to make a virtual machine unique.
    ///
    /// The Mac machine identifier is used by macOS guests to uniquely identify the virtual hardware.
    ///
    /// Two virtual machines running concurrently should not use the same identifier.
    ///
    /// If the virtual machine is serialized to disk, the identifier can be preserved in a binary representation through VZMacMachineIdentifier.dataRepresentation.
    /// The identifier can then be recreated with -[VZMacMachineIdentifier initWithDataRepresentation:] from the binary representation.
    ///
    /// The contents of two identifiers can be compared with -[VZMacMachineIdentifier isEqual:].
    ///
    /// See also: VZMacPlatformConfiguration
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzmacmachineidentifier?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VZMacMachineIdentifier;
);

extern_conformance!(
    unsafe impl NSCopying for VZMacMachineIdentifier {}
);

unsafe impl CopyingHelper for VZMacMachineIdentifier {
    type Result = Self;
}

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

impl VZMacMachineIdentifier {
    extern_methods!(
        /// Create a new unique machine identifier.
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// Get the machine identifier described by the specified data representation.
        ///
        /// Parameter `dataRepresentation`: The opaque data representation of the machine identifier to be obtained.
        ///
        /// Returns: A unique identifier identical to the one that generated the dataRepresentation, or nil if the data is invalid.
        ///
        /// See: VZMacMachineIdentifier.dataRepresentation
        #[unsafe(method(initWithDataRepresentation:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDataRepresentation(
            this: Allocated<Self>,
            data_representation: &NSData,
        ) -> Option<Retained<Self>>;

        /// Opaque data representation of the machine identifier.
        ///
        /// This can be used to recreate the same machine identifier with -[VZMacMachineIdentifier initWithDataRepresentation:].
        ///
        /// See: -[VZMacMachineIdentifier initWithDataRepresentation:]
        #[unsafe(method(dataRepresentation))]
        #[unsafe(method_family = none)]
        pub unsafe fn dataRepresentation(&self) -> Retained<NSData>;
    );
}

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