objc2_virtualization/generated/VZMacAuxiliaryStorage.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// Options when creating a new auxiliary storage.
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzmacauxiliarystorageinitializationoptions?language=objc)
12// NS_OPTIONS
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct VZMacAuxiliaryStorageInitializationOptions(pub NSUInteger);
16bitflags::bitflags! {
17 impl VZMacAuxiliaryStorageInitializationOptions: NSUInteger {
18/// Overwrite an existing auxiliary storage.
19 #[doc(alias = "VZMacAuxiliaryStorageInitializationOptionAllowOverwrite")]
20 const AllowOverwrite = 1<<0;
21 }
22}
23
24unsafe impl Encode for VZMacAuxiliaryStorageInitializationOptions {
25 const ENCODING: Encoding = NSUInteger::ENCODING;
26}
27
28unsafe impl RefEncode for VZMacAuxiliaryStorageInitializationOptions {
29 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_class!(
33 /// Mac auxiliary storage.
34 ///
35 /// The Mac auxiliary storage contains data used by the boot loader and the guest operating system. It is necessary to boot a macOS guest OS.
36 ///
37 /// When creating a new virtual machine from scratch, VZMacOSInstaller can use a default initialized auxiliary storage.
38 /// Use -[VZMacAuxiliaryStorage initCreatingStorageAtURL:hardwareModel:options:error:] to create an empty auxiliary storage.
39 ///
40 /// The hardware model used when creating the new auxiliary storage depends on the restore image that will be used for installation.
41 /// From the restore image, use VZMacOSRestoreImage.mostFeaturefulSupportedConfiguration to get a supported configuration.
42 /// A configuration has a VZMacHardwareModel associated with it.
43 ///
44 /// After initializing the new auxiliary storage, set it on VZMacPlatformConfiguration.auxiliaryStorage to use it.
45 /// The hardware model in VZMacPlatformConfiguration.hardwareModel must be identical to the one used to create the empty
46 /// auxiliary storage. The behavior is undefined otherwise.
47 ///
48 /// When installing macOS, the VZMacOSInstaller lays out data on the auxiliary storage.
49 /// After installation, the macOS guest uses the auxiliary storage for every subsequent boot.
50 ///
51 /// When moving or doing a backup of a virtual machine, the file containing the auxiliary storage must also be moved
52 /// or copied along with the main disk image.
53 ///
54 /// To boot a virtual machine that has already been installed with VZMacOSInstaller, use -[VZMacAuxiliaryStorage initWithContentsOfURL:]
55 /// to set up the auxiliary storage from the existing file used at installation.
56 /// When using an existing file, the hardware model of the VZMacPlatformConfiguration must match the hardware model used when
57 /// the file was created.
58 ///
59 /// See also: VZMacPlatformConfiguration
60 ///
61 /// See also: VZMacOSRestoreImage
62 ///
63 /// See also: VZMacOSConfigurationRequirements
64 ///
65 /// See also: VZMacOSInstaller
66 ///
67 /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzmacauxiliarystorage?language=objc)
68 #[unsafe(super(NSObject))]
69 #[derive(Debug, PartialEq, Eq, Hash)]
70 pub struct VZMacAuxiliaryStorage;
71);
72
73extern_conformance!(
74 unsafe impl NSObjectProtocol for VZMacAuxiliaryStorage {}
75);
76
77impl VZMacAuxiliaryStorage {
78 extern_methods!(
79 #[unsafe(method(new))]
80 #[unsafe(method_family = new)]
81 pub unsafe fn new() -> Retained<Self>;
82
83 #[unsafe(method(init))]
84 #[unsafe(method_family = init)]
85 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
86
87 /// Initialize the auxiliary storage from the URL of an existing file.
88 ///
89 /// Parameter `URL`: The URL of the auxiliary storage on the local file system.
90 ///
91 /// To create a new auxiliary storage, use -[VZMacAuxiliaryStorage initCreatingStorageAtURL:hardwareModel:options:error].
92 #[unsafe(method(initWithURL:))]
93 #[unsafe(method_family = init)]
94 pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
95
96 #[cfg(feature = "VZMacHardwareModel")]
97 /// Write an initialized VZMacAuxiliaryStorage to a URL on a file system.
98 ///
99 /// Parameter `URL`: The URL to write the auxiliary storage to on the local file system.
100 ///
101 /// Parameter `hardwareModel`: The hardware model to use. The auxiliary storage can be laid out differently for different hardware models.
102 ///
103 /// Parameter `options`: Initialization options.
104 ///
105 /// Parameter `error`: If not nil, used to report errors if creation fails.
106 ///
107 /// Returns: A newly initialized VZMacAuxiliaryStorage on success. If an error was encountered returns
108 /// `nil,`and
109 /// `error`contains the error.
110 #[unsafe(method(initCreatingStorageAtURL:hardwareModel:options:error:_))]
111 #[unsafe(method_family = init)]
112 pub unsafe fn initCreatingStorageAtURL_hardwareModel_options_error(
113 this: Allocated<Self>,
114 url: &NSURL,
115 hardware_model: &VZMacHardwareModel,
116 options: VZMacAuxiliaryStorageInitializationOptions,
117 ) -> Result<Retained<Self>, Retained<NSError>>;
118
119 /// The URL of the auxiliary storage on the local file system.
120 #[unsafe(method(URL))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn URL(&self) -> Retained<NSURL>;
123 );
124}
125
126/// VZDeprecated.
127impl VZMacAuxiliaryStorage {
128 extern_methods!(
129 #[deprecated]
130 #[unsafe(method(initWithContentsOfURL:))]
131 #[unsafe(method_family = init)]
132 pub unsafe fn initWithContentsOfURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
133 );
134}