#[non_exhaustive]pub struct ActiveTerminal {
pub task_handle: JoinHandle<()>,
pub surface_output_rx: Receiver<Output>,
pub pty_input_tx: Sender<BytesFromSTDIN>,
pub control_tx: Sender<Protocol>,
}Expand description
An active terminal is running in a Tokio task, so we don’t have direct access to the
underlying wezterm_term::Terminal. Instead we interact with it and the PTY through Tokio
channels.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.task_handle: JoinHandle<()>The task handle to the actively running [crate::shadow_tty::ShadowTerminal]
surface_output_rx: Receiver<Output>A Tokio channel that receives termwiz::surface::Surface updates of the underlying
terminal.
pty_input_tx: Sender<BytesFromSTDIN>A Tokio channel that forwards bytes to the underlying PTY’s STDIN.
control_tx: Sender<Protocol>A Tokio broadcast sender to send protocol messages that control the shadow terminal and PTY. For example; resizing and shutting down.
Implementations§
Source§impl ActiveTerminal
impl ActiveTerminal
Sourcepub fn start(config: Config) -> Self
pub fn start(config: Config) -> Self
Start a [crate::shadow_tty::ShadowTerminal] running in a Tokio task.
Sourcepub async fn send_input(
&self,
bytes: BytesFromSTDIN,
) -> Result<(), SendError<BytesFromSTDIN>>
pub async fn send_input( &self, bytes: BytesFromSTDIN, ) -> Result<(), SendError<BytesFromSTDIN>>
Send input directly into the underlying PTY process. This doesn’t go through the shadow terminal’s “frontend”.
§Errors
If sending the bytes fails
Sourcepub fn kill(&self) -> Result<usize, SendError<Protocol>>
pub fn kill(&self) -> Result<usize, SendError<Protocol>>
End all loops and send OS kill signals to the underlying PTY.
§Errors
If sending message over channel fails.
Sourcepub fn resize(
&self,
width: u16,
height: u16,
) -> Result<usize, SendError<Protocol>>
pub fn resize( &self, width: u16, height: u16, ) -> Result<usize, SendError<Protocol>>
Resize the shadow terminal “frontend”. The PTY is agnostic about size.
§Errors
If sending message over channel fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ActiveTerminal
impl !RefUnwindSafe for ActiveTerminal
impl Send for ActiveTerminal
impl Sync for ActiveTerminal
impl Unpin for ActiveTerminal
impl !UnwindSafe for ActiveTerminal
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more