pub struct DeviceRegistry { /* private fields */ }Expand description
Shared device registry used by controllers such as scenarios and chaos layers.
Implementations§
Source§impl DeviceRegistry
impl DeviceRegistry
Sourcepub fn register(&self, device_id: impl Into<String>, port: DynDevicePort)
pub fn register(&self, device_id: impl Into<String>, port: DynDevicePort)
Registers a device port under the provided identifier.
Sourcepub fn register_handle(
&self,
device_id: impl Into<String>,
handle: DeviceHandle,
)
pub fn register_handle( &self, device_id: impl Into<String>, handle: DeviceHandle, )
Registers a legacy device handle via the runtime adapter.
Sourcepub fn get(&self, device_id: &str) -> Option<DynDevicePort>
pub fn get(&self, device_id: &str) -> Option<DynDevicePort>
Returns a device port if present.
Sourcepub fn device_ids(&self) -> Vec<String>
pub fn device_ids(&self) -> Vec<String>
Returns all registered device identifiers.
Sourcepub fn entries(&self) -> Vec<(String, DynDevicePort)>
pub fn entries(&self) -> Vec<(String, DynDevicePort)>
Returns a snapshot of all registered device ports.
Sourcepub fn remove(&self, device_id: &str) -> Option<DynDevicePort>
pub fn remove(&self, device_id: &str) -> Option<DynDevicePort>
Removes a device by identifier.
Trait Implementations§
Source§impl Clone for DeviceRegistry
impl Clone for DeviceRegistry
Source§fn clone(&self) -> DeviceRegistry
fn clone(&self) -> DeviceRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for DeviceRegistry
impl Default for DeviceRegistry
Source§fn default() -> DeviceRegistry
fn default() -> DeviceRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DeviceRegistry
impl !RefUnwindSafe for DeviceRegistry
impl Send for DeviceRegistry
impl Sync for DeviceRegistry
impl Unpin for DeviceRegistry
impl UnsafeUnpin for DeviceRegistry
impl !UnwindSafe for DeviceRegistry
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