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!(
    /// Configuration of a Virtio file system device.
    ///
    /// This configuration creates a Virtio file system device which allows for exposing
    /// directories on the host to a guest via a tag label.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzvirtiofilesystemdeviceconfiguration?language=objc)
    #[unsafe(super(VZDirectorySharingDeviceConfiguration, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "VZDirectorySharingDeviceConfiguration")]
    pub struct VZVirtioFileSystemDeviceConfiguration;
);

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

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

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

#[cfg(feature = "VZDirectorySharingDeviceConfiguration")]
impl VZVirtioFileSystemDeviceConfiguration {
    extern_methods!(
        /// Configuration of the Virtio file system device.
        ///
        /// Parameter `tag`: The label identifying this device in the guest.
        ///
        /// The tag is presented as a label in the guest identifying this device for mounting. The tag must be valid, which can be checked with +[VZVirtioFileSystemDeviceConfiguration validateTag:error:].
        ///
        /// See: +[VZVirtioFileSystemDeviceConfiguration validateTag:error:]
        #[unsafe(method(initWithTag:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTag(this: Allocated<Self>, tag: &NSString) -> Retained<Self>;

        /// Check if tag is a valid Virtio file system tag.
        ///
        /// Parameter `tag`: The tag to validate.
        ///
        /// Parameter `error`: If not nil, assigned with an error describing why the tag is not valid.
        ///
        /// The tag must be non-empty and less than 36 bytes when encoded in UTF-8.
        #[unsafe(method(validateTag:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn validateTag_error(tag: &NSString) -> Result<(), Retained<NSError>>;

        /// The tag is a string identifying the device.
        ///
        /// The tag is presented as a label in the guest identifying this device for mounting. The tag must be valid, which can be checked with +[VZVirtioFileSystemDeviceConfiguration validateTag:error:].
        ///
        /// See: +[VZVirtioFileSystemDeviceConfiguration validateTag:error:]
        #[unsafe(method(tag))]
        #[unsafe(method_family = none)]
        pub unsafe fn tag(&self) -> Retained<NSString>;

        /// Setter for [`tag`][Self::tag].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setTag:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTag(&self, tag: &NSString);

        #[cfg(feature = "VZDirectoryShare")]
        /// Directory share. Defines how host resources are exposed to the guest virtual machine.
        ///
        /// See: VZSingleDirectoryShare
        ///
        /// See: VZMultipleDirectoryShare
        ///
        /// See: VZLinuxRosettaDirectoryShare
        #[unsafe(method(share))]
        #[unsafe(method_family = none)]
        pub unsafe fn share(&self) -> Option<Retained<VZDirectoryShare>>;

        #[cfg(feature = "VZDirectoryShare")]
        /// Setter for [`share`][Self::share].
        #[unsafe(method(setShare:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShare(&self, share: Option<&VZDirectoryShare>);

        /// The macOS automount tag.
        ///
        /// A device configured with this tag will be automatically mounted in a macOS guest.
        #[unsafe(method(macOSGuestAutomountTag))]
        #[unsafe(method_family = none)]
        pub unsafe fn macOSGuestAutomountTag() -> Retained<NSString>;
    );
}

/// Methods declared on superclass `VZDirectorySharingDeviceConfiguration`.
#[cfg(feature = "VZDirectorySharingDeviceConfiguration")]
impl VZVirtioFileSystemDeviceConfiguration {
    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>;
    );
}