pub trait Transport {
type Backend: Backend;
const LOCAL_FILES: bool = false;
// Required methods
fn terminal_mut(&mut self) -> &mut Terminal<Self::Backend>;
fn poll(&mut self, timeout: Duration) -> Result<Option<RawEvent>>;
// Provided methods
fn write_passthrough(&mut self, _bytes: &[u8]) -> Result<()> { ... }
fn client_term(&self) -> Option<&str> { ... }
fn cell_pixels(&self) -> (u16, u16) { ... }
}Expand description
Bridge between the event loop and whatever terminal it talks to.
Lifecycle: a Transport is constructed in whatever mode it needs
(raw mode, alternate screen, SSH channel attached), then passed by
mutable reference to crate::runtime::run_loop. When the loop
exits, the owner drops the transport, which restores its terminal on quit, error and
panic alike.
The transport owns the Terminal rather than just a raw backend
because ratatui’s Terminal<B> requires B: Backend, which does
not hold for &mut B. Having the transport expose
terminal_mut() keeps the runtime generic without hitting that
trait-bound wall.
Provided Associated Constants§
Sourceconst LOCAL_FILES: bool = false
const LOCAL_FILES: bool = false
Whether the process runs on the user’s own machine, so a path it writes is the user’s.
Required Associated Types§
Required Methods§
Sourcefn terminal_mut(&mut self) -> &mut Terminal<Self::Backend>
fn terminal_mut(&mut self) -> &mut Terminal<Self::Backend>
Mutable access to the owned ratatui Terminal so the runtime
can drive draw.
Provided Methods§
Sourcefn write_passthrough(&mut self, _bytes: &[u8]) -> Result<()>
fn write_passthrough(&mut self, _bytes: &[u8]) -> Result<()>
Forward a raw byte sequence to the same stream the backend writes to, bypassing ratatui’s cell grid. Used for terminal escape sequences that ratatui can’t model directly — kitty graphics APC bytes, future sixel, etc. The default impl silently drops the bytes so transports that don’t speak that dialect (or test doubles) don’t need an override.
§Errors
Returns Err only if the underlying stream write fails.
Sourcefn client_term(&self) -> Option<&str>
fn client_term(&self) -> Option<&str>
Terminal type the client claims to be, in OpenSSH-style
xterm-256color form. The local transport reads $TERM; the
SSH transport returns whatever the peer sent in pty-req.
Returns None when the transport cannot tell.
Capability detection (kitty graphics, true-colour, etc.) should consult this rather than the daemon’s own environment, which is whatever the host running the daemon happened to have.
Sourcefn cell_pixels(&self) -> (u16, u16)
fn cell_pixels(&self) -> (u16, u16)
Pixel size of one terminal cell; DEFAULT_CELL_PIXELS when the client does not say.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".