()
| 73 | } |
| 74 | |
| 75 | pub fn new() -> std::result::Result<Arc<dyn Hypervisor>, HypervisorError> { |
| 76 | #[cfg(feature = "kvm")] |
| 77 | if kvm::KvmHypervisor::is_available()? { |
| 78 | return kvm::KvmHypervisor::new(); |
| 79 | } |
| 80 | |
| 81 | #[cfg(feature = "mshv")] |
| 82 | if mshv::MshvHypervisor::is_available()? { |
| 83 | return mshv::MshvHypervisor::new(); |
| 84 | } |
| 85 | |
| 86 | Err(HypervisorError::HypervisorCreate(anyhow!( |
| 87 | "no supported hypervisor" |
| 88 | ))) |
| 89 | } |
| 90 | |
| 91 | // Returns a `Vec<T>` with a size in bytes at least as large as `size_in_bytes`. |
| 92 | fn vec_with_size_in_bytes<T: Default>(size_in_bytes: usize) -> Vec<T> { |
no outgoing calls