pub struct ManagedDevice {
pub dev_id: i32,
pub config: TestBlockDeviceConfig,
pub segments: Vec<SegmentInfo>,
}Expand description
A handle to a managed test block device.
This struct is returned by DeviceManager::create() and contains
information about a running device including its ID, configuration,
and segment layout.
§Examples
use test_bd::{DeviceManager, TestBlockDeviceConfig};
let mut manager = DeviceManager::new();
let config = TestBlockDeviceConfig {
dev_id: -1,
size: 10 * 1024 * 1024,
seed: 42,
fill_percent: 50,
duplicate_percent: 25,
random_percent: 25,
segments: 20,
unprivileged: false,
};
let device = manager.create(config).expect("Failed to create device");
println!("Created device {} with {} segments", device.dev_id, device.segments.len());Fields§
§dev_id: i32The assigned device ID.
config: TestBlockDeviceConfigThe configuration used to create this device.
segments: Vec<SegmentInfo>Information about each segment in the device.
Trait Implementations§
Source§impl Clone for ManagedDevice
impl Clone for ManagedDevice
Source§fn clone(&self) -> ManagedDevice
fn clone(&self) -> ManagedDevice
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 moreAuto Trait Implementations§
impl Freeze for ManagedDevice
impl RefUnwindSafe for ManagedDevice
impl Send for ManagedDevice
impl Sync for ManagedDevice
impl Unpin for ManagedDevice
impl UnwindSafe for ManagedDevice
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