Type Alias kvm::CpuId

source ·
pub type CpuId = FlexibleArrayWrapper<kvm_cpuid2, kvm_cpuid_entry2>;
Expand description

Wrapper for kvm_cpuid2 which has a zero length array at the end. Hides the zero length array behind a bounds check.

Aliased Type§

struct CpuId { /* private fields */ }

Implementations

§

impl<T, S> FlexibleArrayWrapper<T, S>
where T: FlexibleArray<S> + Default,

Convenience wrapper for flexible array structs.

The FlexibleArray trait must be implemented for the flexible array struct before using this wrapper.

pub fn new(array_len: usize) -> FlexibleArrayWrapper<T, S>

Creates a new FlexibleArrayWrapper for the given flexible array struct type and flexible array type. The flexible array length is set to array_len. vec_with_array_field is used to make sure the resultant wrapper is appropriately sized.

pub fn entries_slice(&self) -> &[S]

Returns a slice of the flexible array member, for inspecting. To modify, use mut_entries_slice instead.

pub fn mut_entries_slice(&mut self) -> &mut [S]

Returns a mutable slice of the flexible array member, for modifying.

pub fn as_ptr(&self) -> *const T

Get a pointer so it can be passed to the kernel. Callers must not access the flexible array member. Using this pointer is unsafe.

pub fn as_mut_ptr(&mut self) -> *mut T

Get a mutable pointer so it can be passed to the kernel. Callers must not access the flexible array member. Using this pointer is unsafe.