### Create, Start, Stop, and Kill a MicroVM Source: https://docs.rs/firepilot/latest/firepilot/machine/index.html This example demonstrates the high-level implementation for managing a microVM. It shows how to create, start, stop, and kill a microVM using the `Machine` struct and `Configuration` builder. Ensure you have the necessary Tokio runtime and Firepilot dependencies. ```rust use tokio::time::{sleep, Duration}; use firepilot::builder::Configuration; use firepilot::machine::Machine; // This configuration is not enough to run a microVM let config = Configuration::new("simple_vm".to_string()); let mut machine = Machine::new(); // Apply configuration to the machine machine.create(config).await.unwrap(); println!("Booting the VM"); machine.start().await.unwrap(); println!("Waiting a few seconds, the VM is started at this point"); sleep(Duration::from_secs(5)).await; machine.stop().await.unwrap(); println!("Shutting down the VM"); machine.kill().await.unwrap(); ``` -------------------------------- ### Start VM Source: https://docs.rs/firepilot/latest/src/firepilot/machine.rs.html Send a InstanceStart signal to the VM. ```APIDOC ## start ### Description Send a InstanceStart signal to the VM. ### Method `async fn start(&self) -> Result<(), FirepilotError>` ### Parameters None ### Response - `Result<(), FirepilotError>`: Ok(()) on success, or a FirepilotError on failure. ``` -------------------------------- ### Create and Run a MicroVM Source: https://docs.rs/firepilot/latest/src/firepilot/machine.rs.html Demonstrates the basic lifecycle of a microVM: creation with configuration, starting, waiting, stopping, and finally killing the VM. This example is illustrative and requires a valid configuration to run. ```rust use tokio::time::{sleep, Duration}; use firepilot::builder::Configuration; use firepilot::machine::Machine; // This configuration is not enough to run a microVM let config = Configuration::new("simple_vm".to_string()); let mut machine = Machine::new(); // Apply configuration to the machine machine.create(config).await.unwrap(); println!("Booting the VM"); machine.start().await.unwrap(); println!("Waiting a few seconds, the VM is started at this point"); sleep(Duration::from_secs(5)).await; machine.stop().await.unwrap(); println!("Shutting down the VM"); machine.kill().await.unwrap(); ``` -------------------------------- ### Start Machine Instance Source: https://docs.rs/firepilot/latest/firepilot/machine/struct.Machine.html Sends an InstanceStart signal to the VM to begin its execution. ```rust pub async fn start(&self) -> Result<(), FirepilotError> ``` -------------------------------- ### Machine::create Source: https://docs.rs/firepilot/latest/firepilot/machine/struct.Machine.html Sets up an initial workspace for the microVM and starts its execution. ```APIDOC ## Machine::create ### Description Sets up an initial workspace for the microVM and starts its execution. This involves several steps including copying drives and the kernel, and spawning the socket process. ### Method `create(&mut self, config: Configuration) -> Result<(), FirepilotError>` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config** (Configuration) - Required - Configuration details for setting up the machine workspace. ### Returns - `Result<(), FirepilotError>`: Ok if the setup is successful, otherwise a FirepilotError. ``` -------------------------------- ### Create Machine Instance Source: https://docs.rs/firepilot/latest/firepilot/machine/struct.Machine.html Sets up an initial workspace for the microVM, copying necessary files and spawning processes. This is a crucial step before the VM can be started. ```rust pub async fn create( &mut self, config: Configuration, ) -> Result<(), FirepilotError> ``` -------------------------------- ### Example Usage of NetworkInterfaceBuilder Source: https://docs.rs/firepilot/latest/firepilot/builder/trait.Builder.html Demonstrates how to use the `NetworkInterfaceBuilder` to construct a `NetworkInterface` object. Ensure necessary imports are present. ```rust use firepilot::builder::Builder; use firepilot::builder::network_interface::NetworkInterfaceBuilder; NetworkInterfaceBuilder::new() .with_iface_id("eth0".to_string()) .with_host_dev_name("tap0".to_string()) .try_build() .unwrap(); ``` -------------------------------- ### DriveBuilder Initialization Source: https://docs.rs/firepilot/latest/firepilot/builder/drive/struct.DriveBuilder.html Creates a new instance of DriveBuilder. Use this as a starting point before configuring drive properties. ```rust pub fn new() -> DriveBuilder ``` -------------------------------- ### Initialize a New Machine Instance Source: https://docs.rs/firepilot/latest/src/firepilot/machine.rs.html Creates a new instance of the Machine struct, initializing its internal executor. This is the starting point for managing a microVM. ```rust pub fn new() -> Self { Machine { executor: Executor::new(), } } ``` -------------------------------- ### Spawn Executor Binary Child Process Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Implement the `spawn_binary_child` method to start the executor process with the given arguments. This is used for spawning the main executor process, not for sending commands to a running VM. ```rust fn spawn_binary_child(&self, args: &Vec) -> Result; ``` -------------------------------- ### Run MicroVM Socket Source: https://docs.rs/firepilot/latest/firepilot/executor/struct.Executor.html Attempts to start the Executor process. The workspace for the machine must already exist, typically created by calling `create_workspace` beforehand. This operation can result in an ExecuteError. ```rust pub fn run_socket(&mut self) -> Result<(), ExecuteError> ``` -------------------------------- ### Firepilot Models Crate Setup Source: https://docs.rs/firepilot_models/1.3.0/src/firepilot_models/lib.rs.html This snippet shows the necessary extern crate declarations and module imports for the firepilot_models crate. It includes dependencies for serialization and URL handling. ```rust #[macro_use] extern crate serde_derive; extern crate serde; extern crate serde_json; extern crate url; pub mod models; ``` -------------------------------- ### Test Firecracker Executor Setup and Socket Management Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Tests the initialization of the Firecracker executor, creation of a workspace, and the lifecycle of the Firecracker socket. Asserts that the socket exists after creation and is removed after destruction. ```rust #[tokio::test] async fn test_executor() { let executor = FirecrackerExecutor { chroot: "/tmp/firepilot".to_string(), exec_binary: PathBuf::from("/usr/bin/firecracker"), }; let mut machine = Executor::new_with_firecracker(executor); machine.create_workspace().unwrap(); machine.run_socket().expect("Failed to run socket"); // expect socket to exist let socket = machine.chroot().join("firecracker.socket"); assert!(socket.exists()); machine.destroy_socket().await.expect("fail to kill"); assert!(!socket.exists()); } ``` -------------------------------- ### Any TypeId Source: https://docs.rs/firepilot/latest/firepilot/builder/drive/struct.DriveBuilder.html Gets the `TypeId` of `self`. This is part of the `Any` trait implementation. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Machine::start Source: https://docs.rs/firepilot/latest/firepilot/machine/struct.Machine.html Sends an InstanceStart signal to the microVM to begin execution. ```APIDOC ## Machine::start ### Description Sends an InstanceStart signal to the VM to begin execution. ### Method `start(&self) -> Result<(), FirepilotError>` ### Returns - `Result<(), FirepilotError>`: Ok if the start signal is sent successfully, otherwise a FirepilotError. ``` -------------------------------- ### BalloonStatsUpdate::type_id Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/balloon_stats_update/struct.BalloonStatsUpdate.html Gets the TypeId of the BalloonStatsUpdate instance. This is part of the Any trait implementation. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Default MmdsConfig Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/mmds_config/struct.MmdsConfig.html Returns the default value for MmdsConfig. This provides a sensible starting point for configuration. ```rust fn default() -> MmdsConfig ``` -------------------------------- ### BootSource::new Constructor Source: https://docs.rs/firepilot_models/1.3.0/x86_64-unknown-linux-gnu/firepilot_models/models/boot_source/struct.BootSource.html Creates a new BootSource instance with the required kernel image path. ```APIDOC ## BootSource::new ### Description Boot source descriptor. ### Signature `pub fn new(kernel_image_path: String) -> BootSource` ``` -------------------------------- ### Create a BootSource Instance Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/boot_source/struct.BootSource.html Constructs a new BootSource with the required kernel image path. Use this to initialize a boot source configuration. ```rust pub fn new(kernel_image_path: String) -> BootSource ``` -------------------------------- ### Building a Complete BootSource Source: https://docs.rs/firepilot/latest/src/firepilot/builder/kernel.rs.html Demonstrates the successful creation of a BootSource object using KernelBuilder when all required fields (kernel image path) are provided. ```rust KernelBuilder::new() .with_kernel_image_path("path/to/kernel".to_string()) .with_initrd_path("path/to/initrd".to_string()) .with_boot_args("console=ttyS0 reboot=k panic=1 pci=off".to_string()) .try_build() .unwrap(); ``` -------------------------------- ### Get Configured Executor Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Returns a reference to the configured executor. Panics if no executor is found, indicating a misconfiguration. ```rust fn executor(&self) -> &dyn Execute { match &self.firecracker { Some(firecracker) => return firecracker, None => panic!("No executor found"), } } ``` -------------------------------- ### BootSource Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/boot_source/struct.BootSource.html Creates a new BootSource instance with the required kernel image path. ```APIDOC ## `new` Function ### Description Boot source descriptor. ### Signature `pub fn new(kernel_image_path: String) -> BootSource` ### Parameters - **kernel_image_path** (`String`): Host level path to the kernel image used to boot the guest. ``` -------------------------------- ### Get Default Vm instance Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/vm/struct.Vm.html Returns the default value for the Vm type. This is useful when no specific state is provided. ```rust fn default() -> Vm ``` -------------------------------- ### Create Workspace Directory Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Creates the necessary directories for VM configuration using `std::fs::create_dir_all`. Errors during creation are mapped to `ExecuteError::WorkspaceCreation`. ```rust std::fs::create_dir_all(self.chroot()) .map_err(|e| ExecuteError::WorkspaceCreation(e.to_string()))?; ``` -------------------------------- ### Vm::new Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/vm/struct.Vm.html Creates a new Vm instance with the specified state. ```APIDOC ## Vm::new ### Description Defines the microVM running state. It is especially useful in the snapshotting context. ### Signature ``` pub fn new(state: State) -> Vm ``` ``` -------------------------------- ### Action Enum Definition Source: https://docs.rs/firepilot/latest/firepilot/executor/enum.Action.html This snippet shows the definition of the Action enum, which includes variants for starting an instance and sending Ctrl+Alt+Del. ```APIDOC ## Enum Action ### Summary ``` pub enum Action { InstanceStart, SendCtrlAltDel, } ``` ### Description Action available on the VM ### Variants * **InstanceStart**: Represents the action to start a VM instance. * **SendCtrlAltDel**: Represents the action to send the Ctrl+Alt+Del command to the VM. ``` -------------------------------- ### PartialNetworkInterface Structure Source: https://docs.rs/firepilot_models/1.3.0/src/firepilot_models/models/partial_network_interface.rs.html Defines a partial network interface structure, used to update the rate limiters for that interface, after microvm start. ```APIDOC ## PartialNetworkInterface ### Description Defines a partial network interface structure, used to update the rate limiters for that interface, after microvm start. ### Fields - **iface_id** (String) - Required - The ID of the network interface. - **rx_rate_limiter** (Option>) - Optional - The rate limiter configuration for the receive path. - **tx_rate_limiter** (Option>) - Optional - The rate limiter configuration for the transmit path. ### Constructor `PartialNetworkInterface::new(iface_id: String) -> PartialNetworkInterface` Creates a new PartialNetworkInterface with the specified interface ID and default (None) rate limiters. ``` -------------------------------- ### Deprecated Error Description Source: https://docs.rs/firepilot/latest/firepilot/executor/enum.ExecuteError.html A deprecated method for getting a string description of the error. Prefer using the Display implementation or `to_string()`. ```rust fn description(&self) -> &str ``` -------------------------------- ### configure_boot_source Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Applies the boot source configuration to the VM. ```APIDOC ## configure_boot_source ### Description Applies the boot source configuration to the VM. ### Method `async fn configure_boot_source(&self, boot_source: BootSource) -> Result<(), ExecuteError>` ### Parameters - **boot_source** (`BootSource`) - The boot source configuration to apply. ### Request Body Represents the `BootSource` configuration, serialized to JSON. ### Response - `Ok(())` on successful configuration. - `Err(ExecuteError)` if serialization fails or the request to the socket fails. ``` -------------------------------- ### Executor::configure_boot_source Source: https://docs.rs/firepilot/latest/firepilot/executor/struct.Executor.html Applies the specified boot source configuration to the VM. ```APIDOC ## Executor::configure_boot_source ### Description Apply the boot source configuration to the VM. ### Signature ```rust pub async fn configure_boot_source(&self, boot_source: BootSource) -> Result<(), ExecuteError> ``` ``` -------------------------------- ### Current Subscriber Attachment Source: https://docs.rs/firepilot/latest/firepilot/executor/enum.ExecuteError.html Attaches the current default `Subscriber` to the type, returning a `WithDispatch` wrapper. Simplifies telemetry setup. ```rust fn with_current_subscriber(self) -> WithDispatch ``` -------------------------------- ### Deprecated Error Cause Source: https://docs.rs/firepilot/latest/firepilot/executor/enum.ExecuteError.html A deprecated method for getting the underlying cause of the error. Use `Error::source` instead, which supports downcasting. ```rust fn cause(&self) -> Option<&dyn Error> ``` -------------------------------- ### Create MicroVM Workspace and Resources Source: https://docs.rs/firepilot/latest/src/firepilot/machine.rs.html Sets up the necessary workspace for a microVM, copies drives and the kernel into the workspace, spawns the control socket, and configures it. This is a core part of the machine creation process. ```rust pub async fn create(&mut self, mut config: Configuration) -> Result<(), FirepilotError> { self.executor = match config.executor { Some(executor) => Ok(executor), None => Err(FirepilotError::Setup( "No executor was provided in the configuration".to_string(), )), } ?; // Step 1. Setup the machine workspace from the executor self.executor.create_workspace()?; // Step 3. Copy drives into the machine workspace let kernel = config.kernel.unwrap(); for drive in config.storage.iter_mut() { let new_drive_path = self.executor.chroot().join(&drive.drive_id); info!("Copy drive {} in the workspace", drive.drive_id); debug!( "Drive from {:?} to {:?}", drive.path_on_host, new_drive_path ); Machine::copy(&drive.path_on_host, &new_drive_path)?; drive.path_on_host = new_drive_path.into_os_string().into_string().unwrap(); } // Step 4. Copy the kernel in the system workspace let kernel_path = self.executor.chroot().join("vmlinux"); info!("Copy kernel in the workspace"); debug!( "Kernel from {:?} to {:?}", kernel.kernel_image_path, kernel_path ); Machine::copy(kernel.kernel_image_path.clone(), kernel_path)?; if let Some(initrd) = kernel.initrd_path.clone() { Machine::copy(initrd, self.executor.chroot().join("initrd"))?; } // Step 5. Spawn the socket process self.executor.run_socket()?; // Step 6. Configure the socket with given informations from the configuration info!("Configure microVM"); ``` -------------------------------- ### Configure Boot Source Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Applies the boot source configuration to the VM by sending a PUT request to the /boot-source endpoint. ```rust let json = serde_json::to_string(&boot_source).map_err(ExecuteError::Serialize)?; let url: hyper::Uri = Uri::new(self.chroot().join("firecracker.socket"), "/boot-source").into(); self.send_request(url, Method::PUT, json).await?; ``` -------------------------------- ### Configure Boot Source Source: https://docs.rs/firepilot/latest/firepilot/executor/struct.Executor.html Asynchronously applies the specified boot source configuration to the VM. This operation can result in an ExecuteError. ```rust pub async fn configure_boot_source( &self, boot_source: BootSource, ) -> Result<(), ExecuteError> ``` -------------------------------- ### Action Enum Definition Source: https://docs.rs/firepilot/latest/firepilot/executor/enum.Action.html Defines the available actions for a virtual machine. Use these variants to specify operations like starting an instance or sending control signals. ```rust pub enum Action { InstanceStart, SendCtrlAltDel, } ``` -------------------------------- ### InstanceActionInfo::new Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/instance_action_info/struct.InstanceActionInfo.html Creates a new InstanceActionInfo with the specified action type. ```APIDOC ## impl InstanceActionInfo ### pub fn new(action_type: ActionType) -> InstanceActionInfo Variant wrapper containing the real action. ``` -------------------------------- ### Create Workspace Source: https://docs.rs/firepilot/latest/firepilot/executor/struct.Executor.html Creates the necessary directories for configuring the VM. This operation can result in an ExecuteError. ```rust pub fn create_workspace(&self) -> Result<(), ExecuteError> ``` -------------------------------- ### Get chroot path for FirecrackerExecutor Source: https://docs.rs/firepilot/latest/firepilot/executor/struct.FirecrackerExecutor.html Returns the PathBuf representing the chroot directory. This directory is used for storing all files related to the microVM, such as drives, rootfs, and kernel. ```rust fn chroot(&self) -> PathBuf ``` -------------------------------- ### Get Chroot Path Source: https://docs.rs/firepilot/latest/firepilot/executor/struct.Executor.html Returns the absolute path to the machine's chroot directory. This directory contains essential VM components like the socket, drives, and kernel. ```rust pub fn chroot(&self) -> PathBuf ``` -------------------------------- ### New MachineConfiguration Source: https://docs.rs/firepilot_models/1.3.0/src/firepilot_models/models/machine_configuration.rs.html Constructor for creating a new MachineConfiguration instance with required parameters. ```APIDOC ## MachineConfiguration::new ### Description Creates a new `MachineConfiguration` with the specified memory size and vCPU count. Other fields will be initialized to their default values (None). ### Parameters - **mem_size_mib** (i32) - Required. The memory size of the VM in MiB. - **vcpu_count** (i32) - Required. The number of vCPUs for the VM. ### Returns - `MachineConfiguration` - A new instance of `MachineConfiguration`. ### Example ```rust let config = MachineConfiguration::new(1024, 2); ``` ``` -------------------------------- ### create_workspace Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Creates the necessary folders for VM configuration. ```APIDOC ## create_workspace ### Description Creates the necessary folders where the VM will be configured. ### Method `fn create_workspace(&self) -> Result<(), ExecuteError>` ### Parameters None ### Response - `Ok(())` on successful creation of the workspace directory. - `Err(ExecuteError)` if the workspace directory cannot be created. ``` -------------------------------- ### MemoryBackend::new Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/memory_backend/struct.MemoryBackend.html Creates a new instance of MemoryBackend. ```APIDOC ## MemoryBackend::new ```rust pub fn new(backend_type: BackendType, backend_path: String) -> MemoryBackend ``` ### Description Constructs a new `MemoryBackend` with the specified backend type and path. ``` -------------------------------- ### NetworkInterface::new Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/network_interface/struct.NetworkInterface.html Creates a new NetworkInterface instance. ```APIDOC ## `impl NetworkInterface` ### `pub fn new(host_dev_name: String, iface_id: String) -> NetworkInterface` #### Description Defines a network interface. #### Parameters - `host_dev_name`: String - Host level path for the guest network interface. - `iface_id`: String - The unique identifier for the interface. #### Returns - `NetworkInterface` - A new instance of the NetworkInterface struct. ``` -------------------------------- ### FirepilotError Enum Definition Source: https://docs.rs/firepilot/latest/firepilot/machine/enum.FirepilotError.html Defines the possible errors that can occur in the Firepilot system. Use this enum to handle specific error conditions like setup, configuration, or execution failures. ```rust pub enum FirepilotError { Setup(String), Configure(String), Execute(String), } ``` -------------------------------- ### InstanceActionInfo::new Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/instance_action_info/struct.InstanceActionInfo.html Creates a new InstanceActionInfo instance. Use this to wrap a specific action type. ```rust pub fn new(action_type: ActionType) -> InstanceActionInfo ``` -------------------------------- ### Executor::create_workspace Source: https://docs.rs/firepilot/latest/firepilot/executor/struct.Executor.html Creates the necessary directories for VM configuration. ```APIDOC ## Executor::create_workspace ### Description Create needed folders where the VM will be configured. ### Signature ```rust pub fn create_workspace(&self) -> Result<(), ExecuteError> ``` ``` -------------------------------- ### Get Chroot Path Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Constructs the full path to the machine's chroot directory, which contains the socket, drives, and kernel. It appends the executor's ID to the base chroot path obtained from the underlying executor. ```rust pub fn chroot(&self) -> PathBuf { self.executor().chroot().join(&self.id) } ``` -------------------------------- ### Drive Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/drive/struct.Drive.html Creates a new Drive instance with the specified drive ID, read-only status, root device status, and host path. ```rust pub fn new( drive_id: String, is_read_only: bool, is_root_device: bool, path_on_host: String, ) -> Drive ``` -------------------------------- ### Configure Drives Source: https://docs.rs/firepilot/latest/firepilot/executor/struct.Executor.html Asynchronously applies all provided drive configurations to the VM. This operation can result in an ExecuteError. ```rust pub async fn configure_drives( &self, drives: Vec, ) -> Result<(), ExecuteError> ``` -------------------------------- ### TokenBucket Struct Definition Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/token_bucket/struct.TokenBucket.html Defines a token bucket with a maximum capacity (size), an initial burst size (one_time_burst) and an interval for refilling purposes (refill_time). The refill-rate is derived from size and refill_time, and it is the constant rate at which the tokens replenish. The refill process only starts happening after the initial burst budget is consumed. Consumption from the token bucket is unbounded in speed which allows for bursts bound in size by the amount of tokens available. Once the token bucket is empty, consumption speed is bound by the refill_rate. ```APIDOC ## Struct TokenBucket ### Description TokenBucket : Defines a token bucket with a maximum capacity (size), an initial burst size (one_time_burst) and an interval for refilling purposes (refill_time). The refill-rate is derived from size and refill_time, and it is the constant rate at which the tokens replenish. The refill process only starts happening after the initial burst budget is consumed. Consumption from the token bucket is unbounded in speed which allows for bursts bound in size by the amount of tokens available. Once the token bucket is empty, consumption speed is bound by the refill_rate. ### Fields - `one_time_burst: Option`: The initial size of a token bucket. - `refill_time: i64`: The amount of milliseconds it takes for the bucket to refill. - `size: i64`: The total number of tokens this bucket can hold. ``` -------------------------------- ### Vsock::new Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/vsock/struct.Vsock.html Constructs a new Vsock device. This function initializes a vsock device, specifying the guest CID and the path to the Unix domain socket for communication. ```APIDOC ## Vsock::new ### Signature ```rust pub fn new(guest_cid: i32, uds_path: String) -> Vsock ``` ### Description Defines a vsock device, backed by a set of Unix Domain Sockets, on the host side. For host-initiated connections, Firecracker will be listening on the Unix socket identified by the path `uds_path`. Firecracker will create this socket, bind and listen on it. Host-initiated connections will be performed by connection to this socket and issuing a connection forwarding request to the desired guest-side vsock port (i.e. `CONNECT 52\n`, to connect to port 52). For guest-initiated connections, Firecracker will expect host software to be bound and listening on Unix sockets at `uds_path_`. E.g. "/path/to/host_vsock.sock_52" for port number 52. ``` -------------------------------- ### InstanceInfo Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/instance_info/struct.InstanceInfo.html Provides a constructor for creating a new InstanceInfo object. ```APIDOC ## impl InstanceInfo ### pub fn new( app_name: String, id: String, state: State, vmm_version: String, ) -> InstanceInfo Describes MicroVM instance information. ``` -------------------------------- ### KernelBuilder Build Implementation Source: https://docs.rs/firepilot/latest/firepilot/builder/kernel/struct.KernelBuilder.html This section details how to finalize the KernelBuilder into a BootSource. ```APIDOC ## `try_build()` ### Description Validates all fields from the builder object and applies them to the final object. ### Signature `fn try_build(self) -> Result` ``` -------------------------------- ### BootSource Struct Source: https://docs.rs/firepilot_models/1.3.0/src/firepilot_models/models/boot_source.rs.html Defines the structure for specifying the boot source of a virtual machine. It includes the kernel image path, optional initrd path, and optional kernel boot arguments. ```APIDOC ## BootSource ### Description Boot source descriptor. This structure defines the necessary components for booting a virtual machine, such as the kernel image and optional initrd and boot arguments. ### Fields - **boot_args** (string) - Optional - Kernel boot arguments passed to the guest. - **initrd_path** (string) - Optional - Host level path to the initrd image used to boot the guest. - **kernel_image_path** (string) - Required - Host level path to the kernel image used to boot the guest. ### Example ```json { "kernel_image_path": "/path/to/vmlinuz", "initrd_path": "/path/to/initrd.img", "boot_args": "console=ttyS0 reboot=k panic=1" } ``` ## BootSource::new ### Description Constructor for the BootSource struct. Initializes a BootSource with a required kernel image path. ### Parameters - **kernel_image_path** (string) - The host level path to the kernel image. ### Returns - BootSource - A new BootSource instance. ``` -------------------------------- ### TryFrom and TryInto for Version Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/mmds_config/enum.Version.html Demonstrates the implementation of TryFrom and TryInto traits for the Version enum, allowing for fallible conversions. ```APIDOC ## impl TryFrom for T where U: Into, ### type Error = Infallible The type returned in the event of a conversion error. ### fn try_from(value: U) -> Result>::Error> Performs the conversion. ## impl TryInto for T where U: TryFrom, ### type Error = >::Error The type returned in the event of a conversion error. ### fn try_into(self) -> Result>::Error> Performs the conversion. ``` -------------------------------- ### InstanceInfo Constructor Source: https://docs.rs/firepilot_models/1.3.0/src/firepilot_models/models/instance_info.rs.html Provides a constructor function for creating new InstanceInfo instances. Ensure all required fields (app_name, id, state, vmm_version) are provided upon instantiation. ```rust impl InstanceInfo { /// Describes MicroVM instance information. pub fn new(app_name: String, id: String, state: State, vmm_version: String) -> InstanceInfo { InstanceInfo { app_name, id, state, vmm_version, } } } ``` -------------------------------- ### configure_drives Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Applies all drive configurations to the VM. ```APIDOC ## configure_drives ### Description Applies all drive configurations to the VM. ### Method `async fn configure_drives(&self, drives: Vec) -> Result<(), ExecuteError>` ### Parameters - **drives** (`Vec`) - A vector of drive configurations to apply. ### Request Body Each element in the `drives` vector represents a drive configuration, serialized to JSON. ### Response - `Ok(())` on successful configuration of all drives. - `Err(ExecuteError)` if serialization fails or the request to the socket fails for any drive. ``` -------------------------------- ### Create a new Vm instance Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/vm/struct.Vm.html Constructs a new Vm instance with the specified state. Useful for initializing a microVM representation. ```rust pub fn new(state: State) -> Vm ``` -------------------------------- ### Create a new NetworkInterfaceBuilder Source: https://docs.rs/firepilot/latest/firepilot/builder/network_interface/struct.NetworkInterfaceBuilder.html Initializes a new instance of the NetworkInterfaceBuilder. ```rust pub fn new() -> NetworkInterfaceBuilder ``` -------------------------------- ### Default BootSource Implementation Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/boot_source/struct.BootSource.html Provides a default BootSource value. This is useful for initializing with standard settings or when no specific configuration is provided. ```rust fn default() -> BootSource ``` -------------------------------- ### Configure Drives Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Applies all drive configurations to the VM by sending PUT requests to the /drives/{drive_id} endpoint for each drive. ```rust let json = serde_json::to_string(&drive).map_err(ExecuteError::Serialize)?; let path = format!("/drives/{}", drive.drive_id); let url: hyper::Uri = Uri::new(self.chroot().join("firecracker.socket"), &path).into(); self.send_request(url, Method::PUT, json).await?; ``` -------------------------------- ### PartialDrive::new Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/partial_drive/struct.PartialDrive.html Constructor for creating a new PartialDrive instance with a given drive ID. ```APIDOC ## impl PartialDrive ### pub fn new(drive_id: String) -> PartialDrive Creates a new `PartialDrive` with the specified `drive_id`. ``` -------------------------------- ### Create New Configuration Source: https://docs.rs/firepilot/latest/firepilot/builder/struct.Configuration.html Initializes a new Configuration object with a mandatory VM ID. Other fields like kernel, executor, storage, and interfaces can be added subsequently. ```rust pub fn new(vm_id: String) -> Configuration ``` -------------------------------- ### NetworkInterface::new Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/network_interface/struct.NetworkInterface.html Creates a new NetworkInterface instance. Requires the host device name and interface ID. ```rust pub fn new(host_dev_name: String, iface_id: String) -> NetworkInterface ``` -------------------------------- ### InstanceActionInfo Constructor Source: https://docs.rs/firepilot_models/1.3.0/src/firepilot_models/models/instance_action_info.rs.html Provides a constructor for creating new InstanceActionInfo instances. Ensure you provide a valid ActionType when calling this. ```rust impl InstanceActionInfo { /// Variant wrapper containing the real action. pub fn new(action_type: ActionType) -> InstanceActionInfo { InstanceActionInfo { action_type } } } ``` -------------------------------- ### Configure Network Interfaces Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Applies network configuration to the VM by sending PUT requests to the /network-interfaces/{iface_id} endpoint for each interface. ```rust let json = serde_json::to_string(&network_interface).map_err(ExecuteError::Serialize)?; let path = format!("/network-interfaces/{}", network_interface.iface_id); let url: hyper::Uri = Uri::new(self.chroot().join("firecracker.socket"), &path).into(); self.send_request(url, Method::PUT, json).await?; ``` -------------------------------- ### Configure MicroVM with Builder Pattern Source: https://docs.rs/firepilot/latest/firepilot/builder/index.html Use this pattern to configure kernel, drives, and executors for a microVM. All fields are optional and validated before building. ```rust use std::{ fs::File, io::copy, path::{Path, PathBuf}, }; use firepilot_models::models::{BootSource, Drive, NetworkInterface}; use firepilot::builder::{Configuration, Builder}; use firepilot::builder::{drive::DriveBuilder, kernel::KernelBuilder}; use firepilot::builder::executor::FirecrackerExecutorBuilder; let path = Path::new("examples/resources"); let kernel_path = path.join("kernel.bin"); let rootfs_path = path.join("rootfs.ext4"); // Configure the kernel in the micro VM let kernel = KernelBuilder::new() .with_kernel_image_path(kernel_path.to_str().unwrap().to_string()) .with_boot_args("reboot=k panic=1 pci=off".to_string()) .try_build() .unwrap(); // Create a single drive that will be used as rootfs let drive = DriveBuilder::new() .with_drive_id("rootfs".to_string()) .with_path_on_host(rootfs_path) .as_read_only() .as_root_device() .try_build() .unwrap(); // Configure the executor that will be used to start the microVM // only firecracker is available, but you could add a jailer executor let executor = FirecrackerExecutorBuilder::new() .with_chroot("./examples/executor/".to_string()) .with_exec_binary(PathBuf::from("/usr/bin/firecracker")) .try_build() .unwrap(); // Execute the builder pattern to create the configuration which can be used // to create a [Machine] let config = Configuration::new("simple_vm".to_string()) .with_kernel(kernel) .with_executor(executor) .with_drive(drive); ``` -------------------------------- ### InstanceInfo Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/instance_info/struct.InstanceInfo.html Creates a new InstanceInfo struct. All fields are required upon initialization. ```rust pub fn new( app_name: String, id: String, state: State, vmm_version: String, ) -> InstanceInfo ``` -------------------------------- ### Create New MachineConfiguration Instance Source: https://docs.rs/firepilot_models/1.3.0/src/firepilot_models/models/machine_configuration.rs.html Provides a constructor function `new` for creating a MachineConfiguration instance. It requires memory size and vCPU count, with other fields initialized to their default or None values. ```rust impl MachineConfiguration { /// Describes the number of vCPUs, memory size, SMT capabilities and the CPU template. pub fn new(mem_size_mib: i32, vcpu_count: i32) -> MachineConfiguration { MachineConfiguration { cpu_template: None, smt: None, mem_size_mib, track_dirty_pages: None, vcpu_count, } } } ``` -------------------------------- ### FullVmConfiguration Struct Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/full_vm_configuration/struct.FullVmConfiguration.html Defines the structure for a complete virtual machine configuration. ```APIDOC ## Struct FullVmConfiguration Represents the complete configuration of a virtual machine. ### Fields * `balloon`: Option> - Configuration for the balloon device. * `drives`: Option> - Configurations for all block devices. * `boot_source`: Option> - Configuration for the boot source. * `logger`: Option> - Configuration for the logger. * `machine_config`: Option> - Configuration for the machine. * `metrics`: Option> - Configuration for metrics. * `mmds_config`: Option> - Configuration for the MMDS. * `network_interfaces`: Option> - Configurations for all network devices. * `vsock`: Option> - Configuration for the VSOCK device. ### Implementations #### `impl FullVmConfiguration` ##### `pub fn new() -> FullVmConfiguration` Creates a new instance of `FullVmConfiguration`. ``` -------------------------------- ### MachineConfiguration::new Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/machine_configuration/struct.MachineConfiguration.html Constructs a new MachineConfiguration instance with specified memory size and vCPU count. ```APIDOC ## Function `new` ### Description Describes the number of vCPUs, memory size, SMT capabilities and the CPU template. ### Signature `pub fn new(mem_size_mib: i32, vcpu_count: i32) -> MachineConfiguration` ``` -------------------------------- ### TokenBucket Default Implementation Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/token_bucket/struct.TokenBucket.html Provides a default TokenBucket configuration. This is useful for setting up a basic token bucket without explicit parameters. ```rust fn default() -> TokenBucket ``` -------------------------------- ### Executor::configure_drives Source: https://docs.rs/firepilot/latest/firepilot/executor/struct.Executor.html Applies the configuration for all provided drives to the VM. ```APIDOC ## Executor::configure_drives ### Description Apply all drives configuration on the VM. ### Signature ```rust pub async fn configure_drives(&self, drives: Vec) -> Result<(), ExecuteError> ``` ``` -------------------------------- ### Drive Implementations Source: https://docs.rs/firepilot_models/1.3.0/x86_64-unknown-linux-gnu/firepilot_models/models/drive/struct.Drive.html Details various implementations for the Drive struct, including Clone, Debug, Default, Deserialize, PartialEq, and Serialize. ```APIDOC ## Implementations ### impl Clone for Drive #### fn clone(&self) -> Drive Returns a duplicate of the value. #### fn clone_from(&mut self, source: &Self) Performs copy-assignment from `source`. ### impl Debug for Drive #### fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. ### impl Default for Drive #### fn default() -> Drive Returns the “default value” for a type. ### impl<'de> Deserialize<'de> for Drive #### fn deserialize<__D>(__deserializer: __D) -> Result where __D: Deserializer<'de>, Deserialize this value from the given Serde deserializer. ### impl PartialEq for Drive #### fn eq(&self, other: &Drive) -> bool Tests for `self` and `other` values to be equal, and is used by `==`. #### fn ne(&self, other: &Rhs) -> bool Tests for `!=`. ### impl Serialize for Drive #### fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where __S: Serializer, Serialize this value into the given Serde serializer. ### impl StructuralPartialEq for Drive ``` -------------------------------- ### Drive Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/drive/struct.Drive.html Provides a constructor function to create a new Drive instance. ```APIDOC ## Implementations ### impl Drive #### pub fn new( drive_id: String, is_read_only: bool, is_root_device: bool, path_on_host: String, ) -> Drive Creates a new Drive instance. ``` -------------------------------- ### clone_to_uninit Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/cpu_template/enum.CpuTemplate.html This is a nightly-only experimental API. Performs copy-assignment from `self` to `dest`. ```APIDOC ## unsafe fn clone_to_uninit(&self, dest: *mut u8) ### Description This is a nightly-only experimental API. (`clone_to_uninit`) Performs copy-assignment from `self` to `dest`. ### Method `clone_to_uninit` ### Parameters - **self** (*CpuTemplate*) - The instance to clone from. - **dest** (**mut u8*) - A mutable pointer to the destination memory location. ``` -------------------------------- ### KernelBuilder try_build Implementation Source: https://docs.rs/firepilot/latest/src/firepilot/builder/kernel.rs.html Implements the `try_build` method for KernelBuilder, ensuring the kernel image path is present before constructing and returning a BootSource object. Panics if the kernel image path is not set. ```rust impl Builder for KernelBuilder { fn try_build(self) -> Result { assert_not_none(stringify!(self.kernel_image_path), &self.kernel_image_path)?; Ok(BootSource { kernel_image_path: self.kernel_image_path.unwrap(), initrd_path: self.initrd_path, boot_args: self.boot_args, }) } } ``` -------------------------------- ### Run Socket Process Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Attempts to spawn the executor process. Assumes the workspace for the machine has already been created. This function initiates the microVM's socket process. ```rust pub fn run_socket(&mut self) -> Result<(), ExecuteError> { info!("Running the socket"); let executor = self.executor(); let sock = self.chroot().join("firecracker.socket"); ``` -------------------------------- ### NetworkInterface::new Constructor Source: https://docs.rs/firepilot_models/1.3.0/x86_64-unknown-linux-gnu/firepilot_models/models/network_interface/struct.NetworkInterface.html Creates a new NetworkInterface instance with the specified host device name and interface ID. ```APIDOC ## impl NetworkInterface ### pub fn new(host_dev_name: String, iface_id: String) -> NetworkInterface Defines a network interface. ``` -------------------------------- ### KernelBuilder Initialization Source: https://docs.rs/firepilot/latest/firepilot/builder/kernel/struct.KernelBuilder.html Provides methods to create and configure a KernelBuilder instance. ```rust pub fn new() -> KernelBuilder ``` ```rust pub fn with_boot_args(self, boot_args: String) -> KernelBuilder ``` ```rust pub fn with_initrd_path(self, initrd_path: String) -> KernelBuilder ``` ```rust pub fn with_kernel_image_path(self, kernel_image_path: String) -> KernelBuilder ``` -------------------------------- ### Resume Machine Instance Source: https://docs.rs/firepilot/latest/firepilot/machine/struct.Machine.html Resumes a paused VM, allowing it to continue its execution. ```rust pub async fn resume(&self) -> Result<(), FirepilotError> ``` -------------------------------- ### Initialize Executor with Default Settings Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Create a new `Executor` instance with default settings, including no specific executor implementation and a default ID. It initializes the RPC client for socket communication. ```rust pub fn new() -> Executor { Executor { firecracker: None, socket_process: None, id: "default".to_string(), client: Client::unix(), } } ``` -------------------------------- ### configure_network Source: https://docs.rs/firepilot/latest/src/firepilot/executor.rs.html Applies network configuration to the VM. ```APIDOC ## configure_network ### Description Applies network configuration to the VM. ### Method `async fn configure_network(&self, network_interfaces: Vec) -> Result<(), ExecuteError>` ### Parameters - **network_interfaces** (`Vec`) - A vector of network interface configurations to apply. ### Request Body Each element in the `network_interfaces` vector represents a network interface configuration, serialized to JSON. ### Response - `Ok(())` on successful configuration of all network interfaces. - `Err(ExecuteError)` if serialization fails or the request to the socket fails for any network interface. ``` -------------------------------- ### Machine::new Source: https://docs.rs/firepilot/latest/firepilot/machine/struct.Machine.html Creates a new instance of the Machine struct. ```APIDOC ## Machine::new ### Description Creates a new instance of the Machine struct. ### Method `new()` ### Returns - `Self`: A new instance of the Machine struct. ``` -------------------------------- ### Attempting to Build with Missing Kernel Image Source: https://docs.rs/firepilot/latest/src/firepilot/builder/kernel.rs.html Illustrates a test case that expects a panic when trying to build a BootSource with KernelBuilder without specifying the kernel image path, which is a required field. ```rust KernelBuilder::new() .with_initrd_path("path/to/initrd".to_string()) .try_build() .unwrap(); ``` -------------------------------- ### BootSource Struct Definition Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/boot_source/struct.BootSource.html Defines the structure for a boot source, specifying the kernel image, optional initrd, and optional kernel boot arguments. ```APIDOC ## Struct BootSource ### Description BootSource : Boot source descriptor. ### Fields - **boot_args** (`Option`): Kernel boot arguments. - **initrd_path** (`Option`): Host level path to the initrd image used to boot the guest. - **kernel_image_path** (`String`): Host level path to the kernel image used to boot the guest. ``` -------------------------------- ### TryFrom and TryInto Implementations Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/instance_info/enum.State.html Demonstrates the TryFrom and TryInto trait implementations for the Instance State enum, allowing for fallible conversions. ```APIDOC ## impl TryFrom for T ### Description Provides a way to convert a value of type `U` into a value of type `T`. ### Associated Types #### type Error = Infallible The type returned in the event of a conversion error. `Infallible` indicates that this conversion will never fail. ### Methods #### fn try_from(value: U) -> Result>::Error> Performs the conversion from `U` to `T`. Since the error type is `Infallible`, this function effectively always returns `Ok(T)`. ## impl TryInto for T ### Description Provides a way to attempt conversion of a value of type `T` into a value of type `U`. ### Associated Types #### type Error = >::Error The type returned in the event of a conversion error. This is determined by the `Error` type of `TryFrom` for `U`. ### Methods #### fn try_into(self) -> Result>::Error> Performs the conversion from `T` to `U`. This method is the inverse of `try_from`. ``` -------------------------------- ### Building a NetworkInterface Source: https://docs.rs/firepilot/latest/firepilot/builder/network_interface/struct.NetworkInterfaceBuilder.html This method attempts to build a `NetworkInterface` from the configured `NetworkInterfaceBuilder`. ```APIDOC ## Builder Implementation ### `try_build()` Validates all the fields from the builder object and applies them to the final object. #### Signature ```rust fn try_build(self) -> Result ``` #### Description This method consumes the `NetworkInterfaceBuilder` and attempts to construct a `NetworkInterface`. It returns a `Result` which is either a successful `NetworkInterface` or a `BuilderError` if validation fails. ``` -------------------------------- ### DriveBuilder Methods Source: https://docs.rs/firepilot/latest/firepilot/builder/drive/struct.DriveBuilder.html Methods for creating and configuring a DriveBuilder instance. ```APIDOC ## DriveBuilder ### `pub fn new() -> DriveBuilder` Creates a new, empty DriveBuilder. ### `pub fn with_drive_id(self, drive_id: String) -> DriveBuilder` Sets the drive ID for the builder. ### `pub fn with_path_on_host(self, path_on_host: PathBuf) -> DriveBuilder` Sets the host path for the builder. ### `pub fn as_root_device(self) -> DriveBuilder` Marks the drive as a root device. ### `pub fn as_read_only(self) -> DriveBuilder` Marks the drive as read-only. ``` -------------------------------- ### FullVmConfiguration PartialEq Implementation Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/full_vm_configuration/struct.FullVmConfiguration.html Allows for equality comparison between FullVmConfiguration instances. ```rust fn eq(&self, other: &FullVmConfiguration) -> bool ``` -------------------------------- ### Vsock::new Source: https://docs.rs/firepilot_models/1.3.0/src/firepilot_models/models/vsock.rs.html Constructor for the Vsock struct. ```APIDOC ## Vsock::new ### Description Creates a new Vsock instance. ### Parameters - **guest_cid** (i32) - The guest Vsock CID. - **uds_path** (String) - Path to the UNIX domain socket used for proxying vsock connections. ### Returns Vsock - A new Vsock instance. ``` -------------------------------- ### Machine::resume Source: https://docs.rs/firepilot/latest/firepilot/machine/struct.Machine.html Resumes a paused microVM instance. ```APIDOC ## Machine::resume ### Description Resumes a paused VM instance. ### Method `resume(&self) -> Result<(), FirepilotError>` ### Returns - `Result<(), FirepilotError>`: Ok if the VM is resumed successfully, otherwise a FirepilotError. ``` -------------------------------- ### Configure Network Source: https://docs.rs/firepilot/latest/firepilot/executor/struct.Executor.html Asynchronously applies the network interface configurations to the VM. This operation can result in an ExecuteError. ```rust pub async fn configure_network( &self, network_interfaces: Vec, ) -> Result<(), ExecuteError> ``` -------------------------------- ### KernelBuilder Methods Source: https://docs.rs/firepilot/latest/firepilot/builder/kernel/struct.KernelBuilder.html These methods allow for the construction and configuration of a KernelBuilder instance. ```APIDOC ## `new()` ### Description Creates a new, empty `KernelBuilder`. ### Signature `pub fn new() -> KernelBuilder` ``` ```APIDOC ## `with_boot_args(boot_args: String)` ### Description Sets the boot arguments for the kernel. ### Signature `pub fn with_boot_args(self, boot_args: String) -> KernelBuilder` ``` ```APIDOC ## `with_initrd_path(initrd_path: String)` ### Description Sets the path to the initial RAM disk (initrd). ### Signature `pub fn with_initrd_path(self, initrd_path: String) -> KernelBuilder` ``` ```APIDOC ## `with_kernel_image_path(kernel_image_path: String)` ### Description Sets the path to the kernel image file. ### Signature `pub fn with_kernel_image_path(self, kernel_image_path: String) -> KernelBuilder` ``` -------------------------------- ### Drive PartialEq Implementation Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/drive/struct.Drive.html Compares two Drive instances for equality. ```rust fn eq(&self, other: &Drive) -> bool ``` ```rust fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### RateLimiter::new Source: https://docs.rs/firepilot_models/1.3.0/src/firepilot_models/models/rate_limiter.rs.html Creates a new RateLimiter with default (None) values for bandwidth and ops. ```APIDOC ## new() ### Description Creates a new `RateLimiter` instance with `bandwidth` and `ops` set to `None`. ### Returns A new `RateLimiter` object. ### Example ```rust let rate_limiter = RateLimiter::new(); ``` ``` -------------------------------- ### PartialDrive Constructor Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/partial_drive/struct.PartialDrive.html Creates a new instance of PartialDrive with a given drive ID. Other fields will be initialized to their default values. ```rust pub fn new(drive_id: String) -> PartialDrive ``` -------------------------------- ### Serialize Implementation for MachineConfiguration Source: https://docs.rs/firepilot_models/1.3.0/firepilot_models/models/machine_configuration/struct.MachineConfiguration.html Allows serializing MachineConfiguration to a Serde serializer. ```rust fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where __S: Serializer, ```