pub struct MockFormatter { /* private fields */ }Expand description
A deterministic in-memory Formatter for tests — no real device is ever
touched. Mirrors MockSshAgent: construct it with a
canned DeviceInfo, then inspect what erase recorded.
Implementations§
Source§impl MockFormatter
impl MockFormatter
Sourcepub fn new(info: DeviceInfo) -> Self
pub fn new(info: DeviceInfo) -> Self
A formatter whose probe returns info (with the queried node overlaid)
and whose erase succeeds and records its arguments. list_devices
returns just info.
Sourcepub fn swapping(first: DeviceInfo, second: DeviceInfo) -> Self
pub fn swapping(first: DeviceInfo, second: DeviceInfo) -> Self
A formatter that probes as first, then (from the second probe onward)
reports second on the same node — to exercise the TOCTOU re-probe guard.
Sourcepub fn with_devices(devices: Vec<DeviceInfo>) -> Self
pub fn with_devices(devices: Vec<DeviceInfo>) -> Self
A formatter whose list_devices returns devices (probe still returns
the first as the canned info) — to test the candidate-listing/filtering.
Sourcepub fn failing(info: DeviceInfo) -> Self
pub fn failing(info: DeviceInfo) -> Self
Like Self::new, but erase fails — to test that a format error
propagates after an approval.
Trait Implementations§
Source§impl Formatter for MockFormatter
impl Formatter for MockFormatter
Source§fn probe(&self, node: &str) -> Result<DeviceInfo, CoreError>
fn probe(&self, node: &str) -> Result<DeviceInfo, CoreError>
Inspect a device without modifying it.
Source§fn list_devices(&self) -> Result<Vec<DeviceInfo>, CoreError>
fn list_devices(&self) -> Result<Vec<DeviceInfo>, CoreError>
Enumerate whole physical devices the user could pick to format — the
raw probe list (the CLI applies
eligible_targets to offer only the
safe ones). Read-only.Auto Trait Implementations§
impl !Freeze for MockFormatter
impl RefUnwindSafe for MockFormatter
impl Send for MockFormatter
impl Sync for MockFormatter
impl Unpin for MockFormatter
impl UnsafeUnpin for MockFormatter
impl UnwindSafe for MockFormatter
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