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!(
    /// Caching options for a Unix Domain Socket.
    ///
    /// This object configures Rosetta to communicate with the Rosetta daemon using a Unix Domain Socket.
    ///
    /// See: VZLinuxRosettaCachingOptions
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzlinuxrosettaunixsocketcachingoptions?language=objc)
    #[unsafe(super(VZLinuxRosettaCachingOptions, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "VZLinuxRosettaCachingOptions")]
    pub struct VZLinuxRosettaUnixSocketCachingOptions;
);

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

#[cfg(feature = "VZLinuxRosettaCachingOptions")]
impl VZLinuxRosettaUnixSocketCachingOptions {
    extern_methods!(
        /// Initialize options to be set on a VZLinuxRosettaDirectoryShare.
        ///
        /// Parameter `path`: The path of the Unix Domain Socket to be used to communicate with the Rosetta translation daemon. This cannot exceed maximumPathLength UTF-8 bytes long.
        ///
        /// Parameter `error`: If not nil, assigned with the error if the initialization failed.
        ///
        /// Rosetta can be optionally configured to use cached translations from the Rosetta translation daemon communicating through a Unix Domain Socket.
        /// If path exceeds maximumPathLength UTF-8 bytes, nil is returned and the error is set.
        /// The guest operating system must have a directory at path created in order for translation caching to operate correctly.
        #[unsafe(method(initWithPath:error:_))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPath_error(
            this: Allocated<Self>,
            path: &NSString,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        /// Initialize default options to be set on a VZLinuxRosettaDirectoryShare.
        ///
        /// The default translation caching configuration uses a Unix Domain Socket at /run/rosettad/rosetta.sock.
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// Path set by initWithPath.
        ///
        /// This is the path of the Unix Domain Socket to be used by Rosetta.
        #[unsafe(method(path))]
        #[unsafe(method_family = none)]
        pub unsafe fn path(&self) -> Retained<NSString>;

        /// The maximum allowed length of path, as defined by the sockaddr_un structure in Linux.
        #[unsafe(method(maximumPathLength))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumPathLength() -> NSUInteger;
    );
}

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