objc2_virtualization/generated/
VZVirtioConsoleDevice.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_protocol!(
10    /// Delegate object for VZVirtioConsoleDevice.
11    ///
12    /// A class conforming to the VZVirtioConsoleDeviceDelegate protocol can provide methods that notify when a console port is opened or closed in the virtual machine.
13    ///
14    /// See: VZVirtioConsoleDevice
15    ///
16    /// See: VZVirtioConsolePort
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzvirtioconsoledevicedelegate?language=objc)
19    pub unsafe trait VZVirtioConsoleDeviceDelegate: NSObjectProtocol {
20        #[cfg(all(feature = "VZConsoleDevice", feature = "VZVirtioConsolePort"))]
21        /// Invoked when a guest process has opened a Virtio console port.
22        ///
23        /// Parameter `consoleDevice`: The console port's console device.
24        ///
25        /// Parameter `consolePort`: The console port that has been opened.
26        ///
27        /// Extra care should be taken to ensure that any pending data from the VZVirtioConsolePort attachment has been processed or flushed before communicating with a new virtual machine process.
28        #[optional]
29        #[unsafe(method(consoleDevice:didOpenPort:))]
30        #[unsafe(method_family = none)]
31        unsafe fn consoleDevice_didOpenPort(
32            &self,
33            console_device: &VZVirtioConsoleDevice,
34            console_port: &VZVirtioConsolePort,
35        );
36
37        #[cfg(all(feature = "VZConsoleDevice", feature = "VZVirtioConsolePort"))]
38        /// Invoked when a guest process has closed a Virtio console port.
39        ///
40        /// Parameter `consoleDevice`: The console port's console device.
41        ///
42        /// Parameter `consolePort`: The console port that has been closed.
43        ///
44        /// It is recommended to finish processing or flushing any remaining data from the VZVirtioConsolePort attachment after a port has been closed.
45        #[optional]
46        #[unsafe(method(consoleDevice:didClosePort:))]
47        #[unsafe(method_family = none)]
48        unsafe fn consoleDevice_didClosePort(
49            &self,
50            console_device: &VZVirtioConsoleDevice,
51            console_port: &VZVirtioConsolePort,
52        );
53    }
54);
55
56extern_class!(
57    /// Class representing a Virtio console device in a virtual machine.
58    ///
59    /// VZVirtioConsoleDevice should not be instantiated directly.
60    ///
61    /// See: VZConsoleDeviceConfiguration
62    ///
63    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzvirtioconsoledevice?language=objc)
64    #[unsafe(super(VZConsoleDevice, NSObject))]
65    #[derive(Debug, PartialEq, Eq, Hash)]
66    #[cfg(feature = "VZConsoleDevice")]
67    pub struct VZVirtioConsoleDevice;
68);
69
70#[cfg(feature = "VZConsoleDevice")]
71extern_conformance!(
72    unsafe impl NSObjectProtocol for VZVirtioConsoleDevice {}
73);
74
75#[cfg(feature = "VZConsoleDevice")]
76impl VZVirtioConsoleDevice {
77    extern_methods!(
78        #[unsafe(method(new))]
79        #[unsafe(method_family = new)]
80        pub unsafe fn new() -> Retained<Self>;
81
82        #[unsafe(method(init))]
83        #[unsafe(method_family = init)]
84        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
85
86        /// Pointer to a delegate object for the console device.
87        #[unsafe(method(delegate))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn delegate(
90            &self,
91        ) -> Option<Retained<ProtocolObject<dyn VZVirtioConsoleDeviceDelegate>>>;
92
93        /// Setter for [`delegate`][Self::delegate].
94        ///
95        /// This is a [weak property][objc2::topics::weak_property].
96        #[unsafe(method(setDelegate:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setDelegate(
99            &self,
100            delegate: Option<&ProtocolObject<dyn VZVirtioConsoleDeviceDelegate>>,
101        );
102
103        #[cfg(feature = "VZVirtioConsolePortArray")]
104        /// The console ports currently being used by this console device.
105        #[unsafe(method(ports))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn ports(&self) -> Retained<VZVirtioConsolePortArray>;
108    );
109}