objc2-virtualization 0.3.2

Bindings to the Virtualization framework
Documentation
//! 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::*;

extern_class!(
    /// Boot loader configuration for a Linux kernel.
    ///
    /// You must use a VZGenericPlatformConfiguration in conjunction with the Linux boot loader.
    /// It is invalid to use it with any other platform configuration.
    ///
    /// See: VZGenericPlatformConfiguration
    ///
    /// See: VZVirtualMachineConfiguration.platform.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzlinuxbootloader?language=objc)
    #[unsafe(super(VZBootLoader, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "VZBootLoader")]
    pub struct VZLinuxBootLoader;
);

#[cfg(feature = "VZBootLoader")]
extern_conformance!(
    unsafe impl NSCopying for VZLinuxBootLoader {}
);

#[cfg(feature = "VZBootLoader")]
unsafe impl CopyingHelper for VZLinuxBootLoader {
    type Result = Self;
}

#[cfg(feature = "VZBootLoader")]
extern_conformance!(
    unsafe impl NSObjectProtocol for VZLinuxBootLoader {}
);

#[cfg(feature = "VZBootLoader")]
impl VZLinuxBootLoader {
    extern_methods!(
        /// Create a VZLinuxBootLoader with the Linux kernel passed as URL.
        ///
        /// Parameter `kernelURL`: The URL of Linux kernel on the local file system.
        #[unsafe(method(initWithKernelURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithKernelURL(
            this: Allocated<Self>,
            kernel_url: &NSURL,
        ) -> Retained<Self>;

        /// URL of the Linux kernel.
        #[unsafe(method(kernelURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn kernelURL(&self) -> Retained<NSURL>;

        /// Setter for [`kernelURL`][Self::kernelURL].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setKernelURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setKernelURL(&self, kernel_url: &NSURL);

        /// Define the command-line parameters passed to the kernel on boot.
        ///
        /// ```text
        ///  https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html
        ///
        /// ```
        #[unsafe(method(commandLine))]
        #[unsafe(method_family = none)]
        pub unsafe fn commandLine(&self) -> Retained<NSString>;

        /// Setter for [`commandLine`][Self::commandLine].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCommandLine:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCommandLine(&self, command_line: &NSString);

        /// Set the optional initial RAM disk. The RAM disk is mapped into memory before booting the kernel.
        #[unsafe(method(initialRamdiskURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn initialRamdiskURL(&self) -> Option<Retained<NSURL>>;

        /// Setter for [`initialRamdiskURL`][Self::initialRamdiskURL].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setInitialRamdiskURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setInitialRamdiskURL(&self, initial_ramdisk_url: Option<&NSURL>);
    );
}

/// Methods declared on superclass `VZBootLoader`.
#[cfg(feature = "VZBootLoader")]
impl VZLinuxBootLoader {
    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>;
    );
}