Enum vboxhelper::vmid::VmId[][src]

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

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

Tuple Fields of Name

0: String
Uuid

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

Tuple Fields of Uuid

0: Uuid

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)

recently added

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.