#![allow(clippy::ptr_as_ptr)]
#![allow(clippy::ptr_cast_constness)]
#![allow(clippy::ref_as_ptr)]
#![allow(clippy::borrow_as_ptr)]
#![allow(clippy::field_reassign_with_default)]
#![allow(clippy::unnecessary_cast)]
#![allow(clippy::wildcard_enum_match_arm)]
#![allow(unused_unsafe)]
#![allow(clippy::let_and_return)]
#![allow(clippy::manual_div_ceil)]
#![allow(clippy::match_wildcard_for_single_variants)]
#![allow(clippy::redundant_closure)]
#![allow(clippy::map_unwrap_or)]
#![allow(clippy::comparison_chain)]
#![allow(clippy::expect_fun_call)]
pub mod config;
pub mod error;
pub mod memory;
pub mod traits;
pub mod types;
#[cfg(target_os = "macos")]
pub mod darwin;
#[cfg(target_os = "linux")]
pub mod linux;
pub use config::{VmConfig, VmConfigBuilder};
pub use error::{HypervisorError, Result};
pub use memory::{GuestAddress, MemoryRegion};
pub use traits::{GuestMemory, Hypervisor, Vcpu, VirtualMachine};
pub use types::{
Arm64Registers, BalloonStats, CpuArch, DeviceSnapshot, DirtyPageInfo, MemoryRegionSnapshot,
PlatformCapabilities, Registers, VcpuExit, VcpuSnapshot, VirtioDeviceConfig, VirtioDeviceType,
VmSnapshot, default_vm_cpu_count, default_vm_memory_size, host_memory_size,
};
pub fn create_hypervisor() -> Result<impl Hypervisor> {
#[cfg(target_os = "macos")]
{
darwin::DarwinHypervisor::new()
}
#[cfg(target_os = "linux")]
{
linux::KvmHypervisor::new()
}
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
{
compile_error!("Unsupported platform: only macOS and Linux are supported")
}
}