pub enum VmId {
    Name(String),
    Uuid(Uuid),
}
Expand description

Identify a virtual machine.

The identifier can be created using the FromStr trait which will first attempt to parse the input parameters as an uuid, and fallback to treat it as a name.

use vboxhelper::vmid::VmId;

// will be treated as an VmId::Uuid
let mid1 = "00112233-4455-6677-8899-aabbccddeeff".parse::<VmId>();
if let Ok(VmId::Uuid(_)) = mid1 {
} else {
  panic!("Not an UUID!");
}

// will be treated as an VmId::Name
let mid2 = "myvim".parse::<VmId>();
if let Ok(VmId::Name(_)) = mid2 {
} else {
  panic!("Not a name!");
}

Variants

Name(String)

Using a name is more human-friendly than an Uuid, but it’s not universally unique.

Uuid(Uuid)

The uuid is (supposed to be) univeraslly unique, but a little cumbersome to memorize or type out.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.