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

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

#[cfg(feature = "VZLinuxRosettaCachingOptions")]
impl VZLinuxRosettaAbstractSocketCachingOptions {
    extern_methods!(
        /// Initialize options to be set on a VZLinuxRosettaDirectoryShare.
        ///
        /// Parameter `name`: The name of the Abstract Socket to be used to communicate with the Rosetta translation daemon. This cannot exceed maximumNameLength 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 an Abstract Socket.
        /// If name exceeds maximumNameLength UTF-8 bytes, nil is returned and the error is set.
        #[unsafe(method(initWithName:error:_))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithName_error(
            this: Allocated<Self>,
            name: &NSString,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        /// Name set by initWithName.
        ///
        /// This is the name of the Abstract Socket to be used by Rosetta.
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub unsafe fn name(&self) -> Retained<NSString>;

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

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