pub struct ArcMutexChipsetDeviceBuilder<'a, 'b, T> { /* private fields */ }
Expand description
A builder to streamline the construction of Arc + CloseableMutex
wrapped
ChipsetDevice
instances.
Implementations§
Source§impl<'a, 'b, T> ArcMutexChipsetDeviceBuilder<'a, 'b, T>where
T: VmmChipsetDevice,
impl<'a, 'b, T> ArcMutexChipsetDeviceBuilder<'a, 'b, T>where
T: VmmChipsetDevice,
Sourcepub fn new(
name: Arc<str>,
new_device_services: impl FnOnce(Weak<CloseableMutex<T>>, Arc<str>) -> ArcMutexChipsetServices<'a, 'b>,
) -> Self
pub fn new( name: Arc<str>, new_device_services: impl FnOnce(Weak<CloseableMutex<T>>, Arc<str>) -> ArcMutexChipsetServices<'a, 'b>, ) -> Self
Create a new ArcMutexChipsetDeviceBuilder
Sourcepub fn omit_saved_state(self) -> Self
pub fn omit_saved_state(self) -> Self
Omit device saved state. Be careful when using this! Currently only used
for MissingDev
!
Sourcepub fn with_pci_addr(self, bus: u8, device: u8, function: u8) -> Self
pub fn with_pci_addr(self, bus: u8, device: u8, function: u8) -> Self
For PCI devices: place the device at the following PCI address
Sourcepub fn on_pci_bus(self, id: BusIdPci) -> Self
pub fn on_pci_bus(self, id: BusIdPci) -> Self
For PCI devices: place the device on the specific bus
Sourcepub fn with_external_pci(self) -> Self
pub fn with_external_pci(self) -> Self
For PCI devices: do not register the device with any PCI bus. This is used when the device is hooked up to a bus (such as a VPCI bus) outside of the vmotherboard infrastructure.
Sourcepub fn add<F>(self, f: F) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>where
F: FnOnce(&mut ArcMutexChipsetServices<'a, 'b>) -> T,
pub fn add<F>(self, f: F) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>where
F: FnOnce(&mut ArcMutexChipsetServices<'a, 'b>) -> T,
Construct a new device.
If the device can fail during initialization, use
try_add
instead.
Includes some basic validation that returns an error if a device
attempts to use a service without also implementing the service’s
corresponding ChipsetDevice::supports_
method.
Sourcepub async fn add_async<F, Fut>(
self,
f: F,
) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>
pub async fn add_async<F, Fut>( self, f: F, ) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>
Just like add
, except async.
Sourcepub fn try_add<F, E>(
self,
f: F,
) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>
pub fn try_add<F, E>( self, f: F, ) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>
Just like add
, except fallible.
Sourcepub async fn try_add_async<F, Fut, E>(
self,
f: F,
) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>
pub async fn try_add_async<F, Fut, E>( self, f: F, ) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>
Just like try_add
, except async.