Skip to main content

HypervisorBackend

Trait HypervisorBackend 

Source
pub trait HypervisorBackend: Send + Sync {
    type Vm: Vm;

    // Required methods
    fn capabilities(&self) -> BackendCapabilities;
    fn create_vm(&self, vcpu_count: u32, mem_size_mib: u64) -> Result<Self::Vm>;
}
Expand description

The top-level entry point: a backend that can create VMs.

Required Associated Types§

Source

type Vm: Vm

The concrete VM type this backend produces.

Required Methods§

Source

fn capabilities(&self) -> BackendCapabilities

Returns the capabilities advertised by this backend on the current host.

Source

fn create_vm(&self, vcpu_count: u32, mem_size_mib: u64) -> Result<Self::Vm>

Construct a new VM with vcpu_count vCPUs and mem_size_mib MiB of guest memory.

Memory is not mapped at this point — the caller drives Vm::map_memory for each region. This split keeps the trait surface compatible with both KVM-style “register a slot” and HVF/VZ-style “hand the framework an mmap” backends.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§