pub struct UnplugSwitch(/* private fields */);Expand description
A pretend USB cable, shared between the mount and whoever wants to yank it.
While it’s unplugged every MTP operation fails with
mtp_rs::Error::Disconnected and reopening fails too, which is exactly
what a real cable glitch looks like from inside the filesystem.
This exists because mtp-rs can’t simulate a disconnect: its virtual device
keeps serving an already-open MtpDevice even after the device is removed
from the discovery registry, so the reconnect path would otherwise be
untestable without hardware. Production code never flips it; the cost is one
relaxed atomic load per MTP operation.
Implementations§
Source§impl UnplugSwitch
impl UnplugSwitch
Trait Implementations§
Source§impl Clone for UnplugSwitch
impl Clone for UnplugSwitch
Source§impl Debug for UnplugSwitch
impl Debug for UnplugSwitch
Auto Trait Implementations§
impl Freeze for UnplugSwitch
impl RefUnwindSafe for UnplugSwitch
impl Send for UnplugSwitch
impl Sync for UnplugSwitch
impl Unpin for UnplugSwitch
impl UnsafeUnpin for UnplugSwitch
impl UnwindSafe for UnplugSwitch
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