DeviceClass

Struct DeviceClass 

Source
#[repr(C)]
pub struct DeviceClass {
Show 14 fields pub parent_class: ObjectClass, pub categories: [c_ulong; 1], pub fw_name: *const c_char, pub desc: *const c_char, pub props_: *const Property, pub props_count_: u16, pub user_creatable: bool, pub hotpluggable: bool, pub legacy_reset: DeviceReset, pub realize: DeviceRealize, pub unrealize: DeviceUnrealize, pub sync_config: DeviceSyncConfig, pub vmsd: *const VMStateDescription, pub bus_type: *const c_char,
}
Expand description

struct DeviceClass - The base class for all devices. @props: Properties accessing state fields. @realize: Callback function invoked when the #DeviceState:realized property is changed to %true. @unrealize: Callback function invoked when the #DeviceState:realized property is changed to %false. @sync_config: Callback function invoked when QMP command device-sync-config is called. Should synchronize device configuration from host to guest part and notify the guest about the change. @hotpluggable: indicates if #DeviceClass is hotpluggable, available as readonly “hotpluggable” property of #DeviceState instance

Fields§

§parent_class: ObjectClass§categories: [c_ulong; 1]

@categories: device categories device belongs to

§fw_name: *const c_char

@fw_name: name used to identify device to firmware interfaces

§desc: *const c_char

@desc: human readable description of device

§props_: *const Property

@props_: properties associated with device, should only be assigned by using device_class_set_props(). The underscore ensures a compile-time error if someone attempts to assign dc->props directly.

§props_count_: u16

@props_count_: number of elements in @props_; should only be assigned by using device_class_set_props().

§user_creatable: bool

@user_creatable: Can user instantiate with -device / device_add?

All devices should support instantiation with device_add, and this flag should not exist. But we’re not there, yet. Some devices fail to instantiate with cryptic error messages. Others instantiate, but don’t work. Exposing users to such behavior would be cruel; clearing this flag will protect them. It should never be cleared without a comment explaining why it is cleared.

TODO remove once we’re there

§hotpluggable: bool§legacy_reset: DeviceReset

@legacy_reset: deprecated device reset method pointer

Modern code should use the ResettableClass interface to implement a multi-phase reset.

TODO: remove once every reset callback is unused

§realize: DeviceRealize§unrealize: DeviceUnrealize§sync_config: DeviceSyncConfig§vmsd: *const VMStateDescription

@vmsd: device state serialisation description for migration/save/restore

§bus_type: *const c_char

@bus_type: bus type private: to qdev / bus.

Trait Implementations§

Source§

impl Clone for DeviceClass

Source§

fn clone(&self) -> DeviceClass

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DeviceClass

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DeviceClass

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for DeviceClass

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.