pub struct PtyManager { /* private fields */ }Expand description
Manages all active terminal sessions.
Stored by the frontend outside of its shared state to avoid reference cycles.
Dropping PtyManager or calling PtyManager::shutdown closes all
sessions gracefully.
Implementations§
Source§impl PtyManager
impl PtyManager
Sourcepub fn with_raw_output(raw_output: Sender<(SessionId, Vec<u8>)>) -> Self
pub fn with_raw_output(raw_output: Sender<(SessionId, Vec<u8>)>) -> Self
Creates an empty manager that also mirrors every session’s raw bytes into
raw_output, keyed by SessionId (the GUI terminal tap). Sessions and
the id space are identical to PtyManager::new; only the extra sink
differs, so the TUI construction path is unaffected.
Sourcepub fn open(
&mut self,
host: &Host,
cols: u16,
rows: u16,
tx: Sender<CoreEvent>,
) -> Result<SessionId>
pub fn open( &mut self, host: &Host, cols: u16, rows: u16, tx: Sender<CoreEvent>, ) -> Result<SessionId>
Opens a new terminal tab for host and returns the assigned SessionId.
Returns immediately; the connection runs in a background task. Connection
or auth errors surface later via CoreEvent::Error + PtyExited.
§Errors
Currently infallible, but kept fallible so the caller’s error handling (and the public API) stays unchanged.
Sourcepub fn write(&mut self, id: SessionId, data: &[u8]) -> Result<()>
pub fn write(&mut self, id: SessionId, data: &[u8]) -> Result<()>
Sends raw bytes to the session identified by id. Unknown id is a no-op.
§Errors
Infallible in practice; a dropped task is ignored like a closed session.
Sourcepub fn resize(&mut self, id: SessionId, cols: u16, rows: u16) -> Result<()>
pub fn resize(&mut self, id: SessionId, cols: u16, rows: u16) -> Result<()>
Forwards a resize to the session identified by id. No-op if not found.
The vt100 parser is resized by the app layer; the task only relays
window_change to the server.
§Errors
Infallible; kept fallible to preserve the public signature.