qemu_command_builder/
name.rs

1use bon::Builder;
2
3use crate::common::OnOff;
4use crate::to_command::{ToArg, ToCommand};
5
6/// Sets the name of the guest. This name will be displayed in the SDL
7/// window caption. The name will also be used for the VNC server. Also
8/// optionally set the top visible process name in Linux. Naming of
9/// individual threads can also be enabled on Linux to aid debugging.
10#[derive(Builder)]
11pub struct Name {
12    name: String,
13    process: Option<String>,
14    debug_threads: Option<OnOff>,
15}
16
17impl ToCommand for Name {
18    fn to_command(&self) -> Vec<String> {
19        let mut cmd = vec![];
20
21        cmd.push("-name".to_string());
22
23        let mut args = self.name.to_string();
24
25        if let Some(process) = &self.process {
26            args.push_str(format!(",process={}", process).as_str());
27        }
28        if let Some(debug_threads) = &self.debug_threads {
29            args.push_str(format!(",debug-threads={}", debug_threads.to_arg()).as_str());
30        }
31
32        cmd.push(args);
33
34        cmd
35    }
36}