Skip to main content

Vm

Struct Vm 

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

Handle to a configured VM ready to enter.

Created via VmBuilder::build().

Implementations§

Source§

impl Vm

Source

pub fn exit_handle(&self) -> ExitHandle

Get a cloneable handle that triggers VM exit from any thread.

Must be called before enter(). Background tasks use this to shut down the VMM (e.g. idle timeout, max duration).

Source

pub fn exit_code(&self) -> Arc<AtomicI32>

Get a shared reference to the VM exit code.

The VMM writes the guest exit code here before invoking exit observers. Read it inside an on_exit closure to record the exit status.

Sentinel value i32::MAX means “not yet set”.

Source

pub fn metrics_handle(&self) -> MetricsHandle

Get a cloneable handle for VM metrics.

Must be called before enter() if the caller needs to sample metrics while the VM is running, because enter() never returns on a successful boot.

Source

pub fn enter(self) -> Result<Infallible>

Start the VM. This call never returns on success — the VMM calls _exit() when the guest shuts down, killing the entire process.

Only returns Err if something fails before the VMM takes over.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Vm

§

impl !Sync for Vm

§

impl !UnwindSafe for Vm

§

impl Freeze for Vm

§

impl Send for Vm

§

impl Unpin for Vm

§

impl UnsafeUnpin for Vm

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> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V