objc2_virtualization/generated/
VZVirtioBlockDeviceConfiguration.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// Configuration of a paravirtualized storage device of type Virtio Block Device.
12    ///
13    /// This device configuration creates a storage device using paravirtualization.
14    /// The emulated device follows the Virtio Block Device specification.
15    ///
16    /// The host implementation of the device is done through an attachment subclassing VZStorageDeviceAttachment
17    /// like VZDiskImageStorageDeviceAttachment.
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzvirtioblockdeviceconfiguration?language=objc)
20    #[unsafe(super(VZStorageDeviceConfiguration, NSObject))]
21    #[derive(Debug, PartialEq, Eq, Hash)]
22    #[cfg(feature = "VZStorageDeviceConfiguration")]
23    pub struct VZVirtioBlockDeviceConfiguration;
24);
25
26#[cfg(feature = "VZStorageDeviceConfiguration")]
27extern_conformance!(
28    unsafe impl NSCopying for VZVirtioBlockDeviceConfiguration {}
29);
30
31#[cfg(feature = "VZStorageDeviceConfiguration")]
32unsafe impl CopyingHelper for VZVirtioBlockDeviceConfiguration {
33    type Result = Self;
34}
35
36#[cfg(feature = "VZStorageDeviceConfiguration")]
37extern_conformance!(
38    unsafe impl NSObjectProtocol for VZVirtioBlockDeviceConfiguration {}
39);
40
41#[cfg(feature = "VZStorageDeviceConfiguration")]
42impl VZVirtioBlockDeviceConfiguration {
43    extern_methods!(
44        #[cfg(feature = "VZStorageDeviceAttachment")]
45        /// Initialize a VZVirtioBlockDeviceConfiguration with a device attachment.
46        ///
47        /// Parameter `attachment`: The storage device attachment. This defines how the virtualized device operates on the host side.
48        ///
49        /// See: VZDiskImageStorageDeviceAttachment
50        #[unsafe(method(initWithAttachment:))]
51        #[unsafe(method_family = init)]
52        pub unsafe fn initWithAttachment(
53            this: Allocated<Self>,
54            attachment: &VZStorageDeviceAttachment,
55        ) -> Retained<Self>;
56
57        /// Check if blockDeviceIdentifier is a valid Virtio block device identifier.
58        ///
59        /// Parameter `blockDeviceIdentifier`: The device identifier to validate.
60        ///
61        /// Parameter `error`: If not nil, assigned with an error describing why the device identifier is not valid.
62        ///
63        /// The device identifier must be at most 20 bytes in length and ASCII-encodable.
64        #[unsafe(method(validateBlockDeviceIdentifier:error:_))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn validateBlockDeviceIdentifier_error(
67            block_device_identifier: &NSString,
68        ) -> Result<(), Retained<NSError>>;
69
70        /// The device identifier is a string identifying the Virtio block device. Empty string by default.
71        ///
72        /// The identifier can be retrieved in the guest via a VIRTIO_BLK_T_GET_ID request.
73        ///
74        /// The identifier must be encodable as an ASCII string of length at most 20 bytes.
75        /// This property can be checked with +[VZVirtioBlockDeviceConfiguration validateBlockDeviceIdentifier:error:].
76        ///
77        /// See: +[VZVirtioBlockDeviceConfiguration validateBlockDeviceIdentifier:error:]
78        #[unsafe(method(blockDeviceIdentifier))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn blockDeviceIdentifier(&self) -> Retained<NSString>;
81
82        /// Setter for [`blockDeviceIdentifier`][Self::blockDeviceIdentifier].
83        #[unsafe(method(setBlockDeviceIdentifier:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn setBlockDeviceIdentifier(&self, block_device_identifier: &NSString);
86    );
87}
88
89/// Methods declared on superclass `VZStorageDeviceConfiguration`.
90#[cfg(feature = "VZStorageDeviceConfiguration")]
91impl VZVirtioBlockDeviceConfiguration {
92    extern_methods!(
93        #[unsafe(method(new))]
94        #[unsafe(method_family = new)]
95        pub unsafe fn new() -> Retained<Self>;
96
97        #[unsafe(method(init))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
100    );
101}