Skip to main content

PowerCmd

Trait PowerCmd 

Source
pub trait PowerCmd {
    // Required methods
    fn start(&self) -> VmResult<()>;
    fn stop<D: Into<Option<Duration>>>(&self, timeout: D) -> VmResult<()>;
    fn hard_stop(&self) -> VmResult<()>;
    fn suspend(&self) -> VmResult<()>;
    fn resume(&self) -> VmResult<()>;
    fn is_running(&self) -> VmResult<bool>;
    fn reboot<D: Into<Option<Duration>>>(&self, timeout: D) -> VmResult<()>;
    fn hard_reboot(&self) -> VmResult<()>;
    fn pause(&self) -> VmResult<()>;
    fn unpause(&self) -> VmResult<()>;
}
Expand description

A trait for managing power state of a VM.

Required Methods§

Source

fn start(&self) -> VmResult<()>

Starts the VM and waits for the VM to start.

Source

fn stop<D: Into<Option<Duration>>>(&self, timeout: D) -> VmResult<()>

Stops the VM softly and waits for the VM to stop.

This function usually only sends a ACPI shutdown signal, so there is no guarantee that calling this function will shut down the VM.

Source

fn hard_stop(&self) -> VmResult<()>

Stops the VM hardly and waits for the VM to stop.

Source

fn suspend(&self) -> VmResult<()>

Suspends the VM and waits for the VM to suspend.

Source

fn resume(&self) -> VmResult<()>

Resumes the suspended VM.

Source

fn is_running(&self) -> VmResult<bool>

Returns true if the VM is running.

Source

fn reboot<D: Into<Option<Duration>>>(&self, timeout: D) -> VmResult<()>

Reboots the VM softly and waits for the VM to start.

Source

fn hard_reboot(&self) -> VmResult<()>

Reboots the VM hardly and waits for the VM to start.

Source

fn pause(&self) -> VmResult<()>

Pauses the VM and waits for the VM to pause.

Source

fn unpause(&self) -> VmResult<()>

Unpauses the VM and waits for the VM to unpause.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§