Struct MediumFormat

Source
pub struct MediumFormat { /* private fields */ }
Expand description

The IMediumFormat interface represents a medium format.

Reference to the official documentation:

https://www.virtualbox.org/sdkref/interface_i_medium_format.html

Implementations§

Source§

impl MediumFormat

Source

pub fn get_id(&self) -> Result<&'static str, VboxError>

Identifier of this format.

The format identifier is a non-null non-empty ASCII string. Note that this string is case-insensitive.

This string is used in methods of other interfaces where it is necessary to specify a medium format, such as VirtualBox::create_medium.

§Returns

Returns &str on success, or a VboxError on failure.

§Example

use virtualbox_rs::VirtualBox;

let vbox = VirtualBox::init().unwrap();
let mediums = vbox.get_hard_disks().unwrap();
let medium = mediums.get(0).unwrap();
let medium_format = medium.get_medium_format().unwrap();
let id = medium_format.get_id().unwrap();
Source

pub fn get_name(&self) -> Result<&'static str, VboxError>

Human-readable description of this format.

Mainly for use in file open dialogs.

§Returns

Returns &str on success, or a VboxError on failure.

§Example

use virtualbox_rs::VirtualBox;

let vbox = VirtualBox::init().unwrap();
let mediums = vbox.get_hard_disks().unwrap();
let medium = mediums.get(0).unwrap();
let medium_format = medium.get_medium_format().unwrap();
let id = medium_format.get_id().unwrap();
Source

pub fn get_capabilities( &self, ) -> Result<Vec<MediumFormatCapabilities>, VboxError>

Capabilities of the format as an array of the flags.

For the meaning of individual capability flags see MediumFormatCapabilities.

§Returns

Returns Vec<MediumFormatCapabilities> on success, or a VboxError on failure.

§Example

use virtualbox_rs::VirtualBox;

let vbox = VirtualBox::init().unwrap();
let mediums = vbox.get_hard_disks().unwrap();
let medium = mediums.get(0).unwrap();
let medium_format = medium.get_medium_format().unwrap();
let capabilities = medium_format.get_capabilities().unwrap();
Source

pub fn describe_file_extensions( &self, ) -> Result<Vec<(&'static str, DeviceType)>, VboxError>

returns the list of supported file extensions and device types.

§Returns

Returns Vec<(extension, device_type) on success, or a VboxError on failure.

  • extension - supported extensions.
  • device_type - device type for extension.
§Example

use virtualbox_rs::VirtualBox;

let vbox = VirtualBox::init().unwrap();
let mediums = vbox.get_hard_disks().unwrap();
let medium = mediums.get(0).unwrap();
let medium_format = medium.get_medium_format().unwrap();
let file_extensions = medium_format.describe_file_extensions().unwrap();
Source

pub fn describe_properties( &self, ) -> Result<Vec<(&'static str, &'static str, DeviceType, MediumFormatCapabilities, &'static str)>, VboxError>

Returns array describing the properties supported by this format.

§Returns

Returns Vec<(names, descriptions, device_type, flags, defaults) on success, or a VboxError on failure.

  • names - supported extensions.
  • descriptions - device type for extension.
  • device_type - device type for extension.
  • flags - device type for extension.
  • defaults - device type for extension.
§Example

use virtualbox_rs::VirtualBox;

let vbox = VirtualBox::init().unwrap();
let mediums = vbox.get_hard_disks().unwrap();
let medium = mediums.get(0).unwrap();
let medium_format = medium.get_medium_format().unwrap();
let describe_properties = medium_format.describe_properties().unwrap();

Trait Implementations§

Source§

impl Debug for MediumFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for MediumFormat

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.