pub struct Snapshot { /* private fields */ }Expand description
The Snapshot interface represents a snapshot of the virtual machine.
Reference to the official documentation:
Implementations§
Source§impl Snapshot
impl Snapshot
Sourcepub fn get_id(&self) -> Result<&'static str, VboxError>
pub fn get_id(&self) -> Result<&'static str, VboxError>
UUID of the snapshot.
§Returns
Returns &str on success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.get_current_snapshot().unwrap().unwrap();
let id = snapshot.get_id().unwrap();Sourcepub fn get_name(&self) -> Result<&'static str, VboxError>
pub fn get_name(&self) -> Result<&'static str, VboxError>
Short name of the snapshot.
§Returns
Returns &str on success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.get_current_snapshot().unwrap().unwrap();
let name = snapshot.get_name().unwrap();Sourcepub fn set_name(&self, name: &str) -> Result<(), VboxError>
pub fn set_name(&self, name: &str) -> Result<(), VboxError>
Short name of the snapshot.
§Arguments
name- &str. Short name of the snapshot.
§Returns
Returns () success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.get_current_snapshot().unwrap().unwrap();
snapshot.set_name("Snapshot_1").unwrap();Sourcepub fn get_description(&self) -> Result<&'static str, VboxError>
pub fn get_description(&self) -> Result<&'static str, VboxError>
Optional description of the snapshot.
§Returns
Returns &str on success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.get_current_snapshot().unwrap().unwrap();
let description = snapshot.get_description().unwrap();Sourcepub fn set_description(&self, name: &str) -> Result<(), VboxError>
pub fn set_description(&self, name: &str) -> Result<(), VboxError>
Optional description of the snapshot.
§Arguments
description- &str. Optional description of the snapshot.
§Returns
Returns () success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.get_current_snapshot().unwrap().unwrap();
snapshot.set_description("description").unwrap();Sourcepub fn get_time_stamp(&self) -> Result<i64, VboxError>
pub fn get_time_stamp(&self) -> Result<i64, VboxError>
Timestamp of the snapshot, in milliseconds since 1970-01-01 UTC.
§Returns
Returns i64 success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.get_current_snapshot().unwrap().unwrap();
let time_stamp = snapshot.get_time_stamp().unwrap();Sourcepub fn get_online(&self) -> Result<bool, VboxError>
pub fn get_online(&self) -> Result<bool, VboxError>
true if this snapshot is an online snapshot and false otherwise.
When this attribute is true, the Machine::get_state_file_path attribute of the machine object associated with this snapshot will point to the saved state file. Otherwise, it will be an empty string.
§Returns
Returns bool success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.get_current_snapshot().unwrap().unwrap();
let time_stamp = snapshot.get_time_stamp().unwrap();Sourcepub fn get_machine(&self) -> Result<Machine, VboxError>
pub fn get_machine(&self) -> Result<Machine, VboxError>
Virtual machine this snapshot is taken on.
This object stores all settings the machine had when taking this snapshot.
§Returns
Returns Machine success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.get_current_snapshot().unwrap().unwrap();
let machine = snapshot.get_machine().unwrap();Sourcepub fn get_parent(&self) -> Result<Option<Snapshot>, VboxError>
pub fn get_parent(&self) -> Result<Option<Snapshot>, VboxError>
Parent snapshot (a snapshot this one is based on), or None if the snapshot has no parent (i.e. is the first snapshot).
§Returns
Returns Option<Snapshot> success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.find_snapshot("Snapshot_2").unwrap();
let machine = snapshot.get_machine().unwrap();Sourcepub fn get_children(&self) -> Result<Vec<Snapshot>, VboxError>
pub fn get_children(&self) -> Result<Vec<Snapshot>, VboxError>
Child snapshots (all snapshots having this one as a parent).
By inspecting this attribute starting with a machine’s root snapshot (which can be obtained by calling Machine::find_snapshot with empty UUID), a machine’s snapshots tree can be iterated over.
§Returns
Returns Vec<Snapshot> success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.find_snapshot("Snapshot_2").unwrap();
let children = snapshot.get_children().unwrap();Sourcepub fn get_children_count(&self) -> Result<u32, VboxError>
pub fn get_children_count(&self) -> Result<u32, VboxError>
Returns the number of direct children of this snapshot.
§Returns
Returns Vec<Snapshot> success, or a VboxError on failure.
§Example
use virtualbox_rs::VirtualBox;
let vbox = VirtualBox::init().unwrap();
let machine = vbox.
find_machines("Freebsd_14").unwrap();
let snapshot = machine.find_snapshot("Snapshot_2").unwrap();
let count = snapshot.get_children_count().unwrap();