1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//! 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::*;
/// Availability of Rosetta support for Linux binaries.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzlinuxrosettaavailability?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct VZLinuxRosettaAvailability(pub NSInteger);
impl VZLinuxRosettaAvailability {
/// Rosetta support for Linux binaries is not available on the host system.
#[doc(alias = "VZLinuxRosettaAvailabilityNotSupported")]
pub const NotSupported: Self = Self(0);
/// Rosetta support for Linux binaries is not installed on the host system.
#[doc(alias = "VZLinuxRosettaAvailabilityNotInstalled")]
pub const NotInstalled: Self = Self(1);
/// Rosetta support for Linux is installed on the host system.
#[doc(alias = "VZLinuxRosettaAvailabilityInstalled")]
pub const Installed: Self = Self(2);
}
unsafe impl Encode for VZLinuxRosettaAvailability {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for VZLinuxRosettaAvailability {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// Directory share to enable Rosetta support for Linux binaries.
///
/// This directory share exposes Rosetta within a shared directory in the guest. Linux can use it to translate x86_64 binaries.
///
/// See: VZDirectorySharingDeviceConfiguration
///
/// See: VZSharedDirectory
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzlinuxrosettadirectoryshare?language=objc)
#[unsafe(super(VZDirectoryShare, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "VZDirectoryShare")]
pub struct VZLinuxRosettaDirectoryShare;
);
#[cfg(feature = "VZDirectoryShare")]
extern_conformance!(
unsafe impl NSObjectProtocol for VZLinuxRosettaDirectoryShare {}
);
#[cfg(feature = "VZDirectoryShare")]
impl VZLinuxRosettaDirectoryShare {
extern_methods!(
/// Initialize a Rosetta directory share if Rosetta support for Linux binaries is installed.
///
/// Parameter `error`: Error object to store the error, if an error exists.
///
/// The call returns an error if Rosetta is not available for a directory share. To install Rosetta support, use +[VZLinuxRosettaDirectoryShare installRosettaIfNeeded:].
///
/// See: +[VZLinuxRosettaDirectoryShare installRosettaIfNeeded:]
#[unsafe(method(initWithError:_))]
#[unsafe(method_family = init)]
pub unsafe fn initWithError(
this: Allocated<Self>,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(feature = "block2")]
/// Download and install Rosetta support for Linux binaries if necessary.
///
/// Parameter `completionHandler`: The completion handler gets called with a valid error on failure and a nil error on success. It will also be invoked on an arbitrary queue.
///
/// The call prompts the user through the download and install flow for Rosetta. This call is successful if the error is nil.
///
/// See: +[VZLinuxRosettaDirectoryShare availability]
#[unsafe(method(installRosettaWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn installRosettaWithCompletionHandler(
completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "VZLinuxRosettaCachingOptions")]
/// Enable translation caching and configure the socket communication type for Rosetta.
#[unsafe(method(options))]
#[unsafe(method_family = none)]
pub unsafe fn options(&self) -> Option<Retained<VZLinuxRosettaCachingOptions>>;
#[cfg(feature = "VZLinuxRosettaCachingOptions")]
/// Setter for [`options`][Self::options].
#[unsafe(method(setOptions:))]
#[unsafe(method_family = none)]
pub unsafe fn setOptions(&self, options: Option<&VZLinuxRosettaCachingOptions>);
/// Check the availability of Rosetta support for the directory share.
#[unsafe(method(availability))]
#[unsafe(method_family = none)]
pub unsafe fn availability() -> VZLinuxRosettaAvailability;
);
}
/// Methods declared on superclass `VZDirectoryShare`.
#[cfg(feature = "VZDirectoryShare")]
impl VZLinuxRosettaDirectoryShare {
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>;
);
}