[−][src]Struct kvm_ioctls::CpuId
Wrapper over the kvm_cpuid2
structure.
The structure has a zero length array at the end, hidden behind bounds check.
Methods
impl CpuId
[src]
pub fn new(array_len: usize) -> CpuId
[src]
Creates a new CpuId
structure that contains at most array_len
KVM CPUID entries.
Arguments
array_len
- Maximum number of CPUID entries.
Example
use kvm_ioctls::CpuId; let cpu_id = CpuId::new(32);
pub fn from_entries(entries: &[kvm_cpuid_entry2]) -> CpuId
[src]
Creates a new CpuId
structure based on a supplied vector of kvm_cpuid_entry2
.
Arguments
entries
- The vector ofkvm_cpuid_entry2
entries.
Example
extern crate kvm_bindings; use kvm_bindings::kvm_cpuid_entry2; use kvm_ioctls::CpuId; // Create a Cpuid to hold one entry. let mut cpuid = CpuId::new(1); let mut entries = cpuid.mut_entries_slice().to_vec(); let new_entry = kvm_cpuid_entry2 { function: 0x4, index: 0, flags: 1, eax: 0b1100000, ebx: 0, ecx: 0, edx: 0, padding: [0, 0, 0], }; entries.insert(0, new_entry); cpuid = CpuId::from_entries(&entries);
pub fn mut_entries_slice(&mut self) -> &mut [kvm_cpuid_entry2]
[src]
Returns the mutable entries slice so they can be modified before passing to the VCPU.
Example
use kvm_ioctls::{CpuId, Kvm, MAX_KVM_CPUID_ENTRIES}; let kvm = Kvm::new().unwrap(); let mut cpuid = kvm.get_supported_cpuid(MAX_KVM_CPUID_ENTRIES).unwrap(); let cpuid_entries = cpuid.mut_entries_slice();
pub fn as_ptr(&self) -> *const kvm_cpuid2
[src]
Get a pointer so it can be passed to the kernel. Using this pointer is unsafe.
pub fn as_mut_ptr(&mut self) -> *mut kvm_cpuid2
[src]
Get a mutable pointer so it can be passed to the kernel. Using this pointer is unsafe.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,