pub struct SftpManager { /* private fields */ }Expand description
Manages a persistent SSH+SFTP background task.
Use SftpManager::connect to create, SftpManager::send to enqueue
commands, and SftpManager::disconnect for a clean shutdown.
Implementations§
Source§impl SftpManager
impl SftpManager
Sourcepub async fn connect(host: &Host, event_tx: Sender<CoreEvent>) -> Result<Self>
pub async fn connect(host: &Host, event_tx: Sender<CoreEvent>) -> Result<Self>
Connects to host via SSH + SFTP subsystem and spawns the background task.
On success sends CoreEvent::SftpConnected through event_tx.
On failure the task sends CoreEvent::SftpDisconnected.
§Errors
Returns an error if the SSH connection fails before the task is spawned.
Sourcepub fn send(&self, cmd: SftpCommand)
pub fn send(&self, cmd: SftpCommand)
Enqueues a command (fire-and-forget). Silently drops if the task exited.
Sourcepub fn disconnect(self)
pub fn disconnect(self)
Sends SftpCommand::Disconnect and drops the sender.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SftpManager
impl RefUnwindSafe for SftpManager
impl Send for SftpManager
impl Sync for SftpManager
impl Unpin for SftpManager
impl UnsafeUnpin for SftpManager
impl UnwindSafe for SftpManager
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