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!(
    /// Virtio Console Port Configuration Array
    ///
    /// This array stores a collection of port configurations for a VZVirtioConsoleConfiguration. The index in the array corresponds to the port index used in the virtual machine.
    ///
    /// A maximumPortCount value may be set but must be larger than the highest indexed port. If no maximumPortCount value is set, the highest indexed port will be used.
    ///
    /// See: VZVirtioConsoleConfiguration
    ///
    /// See: VZVirtioConsolePortConfiguration
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzvirtioconsoleportconfigurationarray?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct VZVirtioConsolePortConfigurationArray;
);

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

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

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

impl VZVirtioConsolePortConfigurationArray {
    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>;

        /// The maximum number of ports allocated by this device. The default is the number of ports attached to this device.
        #[unsafe(method(maximumPortCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumPortCount(&self) -> u32;

        /// Setter for [`maximumPortCount`][Self::maximumPortCount].
        #[unsafe(method(setMaximumPortCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaximumPortCount(&self, maximum_port_count: u32);

        #[cfg(all(
            feature = "VZConsolePortConfiguration",
            feature = "VZVirtioConsolePortConfiguration"
        ))]
        /// Get a port configuration at the specified index.
        #[unsafe(method(objectAtIndexedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectAtIndexedSubscript(
            &self,
            port_index: NSUInteger,
        ) -> Option<Retained<VZVirtioConsolePortConfiguration>>;

        #[cfg(all(
            feature = "VZConsolePortConfiguration",
            feature = "VZVirtioConsolePortConfiguration"
        ))]
        /// Set a port configuration at the specified index.
        #[unsafe(method(setObject:atIndexedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setObject_atIndexedSubscript(
            &self,
            configuration: Option<&VZVirtioConsolePortConfiguration>,
            port_index: NSUInteger,
        );
    );
}