pub fn filter_qemu_cmdline(cmdline: &str) -> Option<String> {
    if cmdline.contains("qemu-system") && cmdline.contains("guest=") {
        let vmname: Vec<Vec<&str>> = cmdline
            .split("guest=")
            .map(|x| x.split(',').collect())
            .collect();

        match (vmname[1].len(), vmname[1][0].is_empty()) {
            (1, _) => return None,
            (_, true) => return None,
            (_, false) => return Some(String::from(vmname[1][0])),
        }
    }
    None
}
/// Returns an Option containing the VM name of a qemu process.
///
/// Then VM name is extracted from the command line.
Returns an Option containing the VM name of a qemu process.
Then VM name is extracted from the command line.
Returns an Option containing the VM name of a qemu process . Then VM name is extracted from the command line .
pub fn filter_qemu_cmdline(cmdline: &str) -> Option<String> {
    if cmdline.contains("qemu-system") && cmdline.contains("guest=") {
        let vmname: Vec<Vec<&str>> = cmdline
            .split("guest=")
            .map(|x| x.split(',').collect())
            .collect();
        match (vmname[1].len(), vmname[1][0].is_empty()) {
            (1, _) => return None,
            (_, true) => return None,
            (_, false) => return Some(String::from(vmname[1][0])),
        }
    }
    None
}
pub fn filter_qemu_cmdline ( cmdline : & str ) -> Option < String > { if cmdline . contains ( " " ) && cmdline . contains ( " " ) { let vmname : Vec < Vec < & str > > = cmdline . split ( " " ) . map ( | x | x . split ( ',' ) . collect ( ) ) . collect ( ) ; match ( vmname [ 1 ] . len ( ) , vmname [ 1 ] [ 0 ] . is_empty ( ) ) { ( 1 , _ ) => return None , ( _ , true ) => return None , ( _ , false ) => return Some ( String :: from ( vmname [ 1 ] [ 0 ] ) ) , } } None }
Returns an Option containing the VM name of a qemu process.
Returns an Option containing the VM name of a qemu process .
cmdline
&str
cmdline
&str