pub struct ArcMutexChipsetDeviceBuilder<S, T> { /* private fields */ }
Expand description
A builder to streamline the construction of Arc + CloseableMutex
wrapped
[ChipsetDevice
] instances.
Implementations§
Source§impl<S, T> ArcMutexChipsetDeviceBuilder<S, T>where
T: ChipsetDevice,
S: ChipsetServices + ArcMutexChipsetServicesFinalize<T>,
impl<S, T> ArcMutexChipsetDeviceBuilder<S, T>where
T: ChipsetDevice,
S: ChipsetServices + ArcMutexChipsetServicesFinalize<T>,
Sourcepub fn new(
name: Arc<str>,
new_device_services: impl FnOnce(Weak<CloseableMutex<dyn ChipsetDevice>>, Arc<str>) -> S,
) -> ArcMutexChipsetDeviceBuilder<S, T>
pub fn new( name: Arc<str>, new_device_services: impl FnOnce(Weak<CloseableMutex<dyn ChipsetDevice>>, Arc<str>) -> S, ) -> ArcMutexChipsetDeviceBuilder<S, T>
Create a new ArcMutexChipsetDeviceBuilder
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 with_external_pci(self) -> Self
pub fn with_external_pci(self) -> Self
For PCI devices: do not register the device with the chipset’s PCI services. This is used when the device is hooked up to a bus (such as a VPCI bus) outside of the chipset infrastructure.
Sourcepub fn add<F>(self, f: F) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>
pub fn add<F>(self, f: F) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>
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>where
F: AsyncFnOnce(&mut S) -> T,
pub async fn add_async<F, Fut>(
self,
f: F,
) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>where
F: AsyncFnOnce(&mut S) -> T,
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, E>(
self,
f: F,
) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>
pub async fn try_add_async<F, E>( self, f: F, ) -> Result<Arc<CloseableMutex<T>>, AddDeviceError>
Just like try_add
, except async.
Auto Trait Implementations§
impl<S, T> Freeze for ArcMutexChipsetDeviceBuilder<S, T>where
S: Freeze,
impl<S, T> !RefUnwindSafe for ArcMutexChipsetDeviceBuilder<S, T>
impl<S, T> !Send for ArcMutexChipsetDeviceBuilder<S, T>
impl<S, T> !Sync for ArcMutexChipsetDeviceBuilder<S, T>
impl<S, T> Unpin for ArcMutexChipsetDeviceBuilder<S, T>where
S: Unpin,
impl<S, T> !UnwindSafe for ArcMutexChipsetDeviceBuilder<S, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more