objc2_virtualization/generated/
VZEFIVariableStore.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 EFI variable store.
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzefivariablestoreinitializationoptions?language=objc)
12// NS_OPTIONS
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct VZEFIVariableStoreInitializationOptions(pub NSUInteger);
16bitflags::bitflags! {
17    impl VZEFIVariableStoreInitializationOptions: NSUInteger {
18        #[doc(alias = "VZEFIVariableStoreInitializationOptionAllowOverwrite")]
19        const AllowOverwrite = 1<<0;
20    }
21}
22
23unsafe impl Encode for VZEFIVariableStoreInitializationOptions {
24    const ENCODING: Encoding = NSUInteger::ENCODING;
25}
26
27unsafe impl RefEncode for VZEFIVariableStoreInitializationOptions {
28    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
29}
30
31extern_class!(
32    /// EFI variable store
33    ///
34    /// The EFI variable store contains NVRAM variables exposed by the EFI ROM.
35    ///
36    /// See also: VZEFIBootLoader
37    ///
38    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzefivariablestore?language=objc)
39    #[unsafe(super(NSObject))]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    pub struct VZEFIVariableStore;
42);
43
44extern_conformance!(
45    unsafe impl NSObjectProtocol for VZEFIVariableStore {}
46);
47
48impl VZEFIVariableStore {
49    extern_methods!(
50        #[unsafe(method(new))]
51        #[unsafe(method_family = new)]
52        pub unsafe fn new() -> Retained<Self>;
53
54        #[unsafe(method(init))]
55        #[unsafe(method_family = init)]
56        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
57
58        /// Initialize the variable store from the URL of an existing file.
59        ///
60        /// Parameter `URL`: The URL of the variable store on the local file system.
61        ///
62        /// To create a new variable store, use -[VZEFIVariableStore initCreatingVariableStoreAtURL:options:error].
63        #[unsafe(method(initWithURL:))]
64        #[unsafe(method_family = init)]
65        pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
66
67        /// Write an initialized VZEFIVariableStore to a URL on a file system.
68        ///
69        /// Parameter `URL`: The URL to write the variable store to on the local file system.
70        ///
71        /// Parameter `options`: Initialization options.
72        ///
73        /// Parameter `error`: If not nil, used to report errors if creation fails.
74        ///
75        /// Returns: A newly initialized VZEFIVariableStore on success. If an error was encountered returns
76        /// `nil,`and
77        /// `error`contains the error.
78        #[unsafe(method(initCreatingVariableStoreAtURL:options:error:_))]
79        #[unsafe(method_family = init)]
80        pub unsafe fn initCreatingVariableStoreAtURL_options_error(
81            this: Allocated<Self>,
82            url: &NSURL,
83            options: VZEFIVariableStoreInitializationOptions,
84        ) -> Result<Retained<Self>, Retained<NSError>>;
85
86        /// The URL of the variable store on the local file system.
87        #[unsafe(method(URL))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn URL(&self) -> Retained<NSURL>;
90    );
91}