pub struct Channel<Send: From<(ChannelId, ChannelMsg)>> { /* private fields */ }Expand description
A handle to a session channel.
Allows you to read and write from a channel without borrowing the session
Implementations§
Source§impl<S: From<(ChannelId, ChannelMsg)> + Send + Sync + 'static> Channel<S>
impl<S: From<(ChannelId, ChannelMsg)> + Send + Sync + 'static> Channel<S>
Sourcepub async fn writable_packet_size(&self) -> usize
pub async fn writable_packet_size(&self) -> usize
Returns the min between the maximum packet size and the remaining window size in the channel.
pub fn id(&self) -> ChannelId
Sourcepub fn split(self) -> (ChannelReadHalf, ChannelWriteHalf<S>)
pub fn split(self) -> (ChannelReadHalf, ChannelWriteHalf<S>)
Split this Channel into a ChannelReadHalf and a ChannelWriteHalf, which can be
used to read and write concurrently.
Sourcepub async fn request_pty(
&self,
want_reply: bool,
term: &str,
col_width: u32,
row_height: u32,
pix_width: u32,
pix_height: u32,
terminal_modes: &[(Pty, u32)],
) -> Result<(), Error>
pub async fn request_pty( &self, want_reply: bool, term: &str, col_width: u32, row_height: u32, pix_width: u32, pix_height: u32, terminal_modes: &[(Pty, u32)], ) -> Result<(), Error>
Request a pseudo-terminal with the given characteristics.
Sourcepub async fn request_shell(&self, want_reply: bool) -> Result<(), Error>
pub async fn request_shell(&self, want_reply: bool) -> Result<(), Error>
Request a remote shell.
Sourcepub async fn exec<A: Into<Vec<u8>>>(
&self,
want_reply: bool,
command: A,
) -> Result<(), Error>
pub async fn exec<A: Into<Vec<u8>>>( &self, want_reply: bool, command: A, ) -> Result<(), Error>
Execute a remote program (will be passed to a shell). This can be used to implement scp (by calling a remote scp and tunneling to its standard input).
Sourcepub async fn request_subsystem<A: Into<String>>(
&self,
want_reply: bool,
name: A,
) -> Result<(), Error>
pub async fn request_subsystem<A: Into<String>>( &self, want_reply: bool, name: A, ) -> Result<(), Error>
Request the start of a subsystem with the given name.
Sourcepub async fn request_x11<A: Into<String>, B: Into<String>>(
&self,
want_reply: bool,
single_connection: bool,
x11_authentication_protocol: A,
x11_authentication_cookie: B,
x11_screen_number: u32,
) -> Result<(), Error>
pub async fn request_x11<A: Into<String>, B: Into<String>>( &self, want_reply: bool, single_connection: bool, x11_authentication_protocol: A, x11_authentication_cookie: B, x11_screen_number: u32, ) -> Result<(), Error>
Request X11 forwarding through an already opened X11 channel. See RFC4254 for security issues related to cookies.
Sourcepub async fn set_env<A: Into<String>, B: Into<String>>(
&self,
want_reply: bool,
variable_name: A,
variable_value: B,
) -> Result<(), Error>
pub async fn set_env<A: Into<String>, B: Into<String>>( &self, want_reply: bool, variable_name: A, variable_value: B, ) -> Result<(), Error>
Set a remote environment variable.
Sourcepub async fn window_change(
&self,
col_width: u32,
row_height: u32,
pix_width: u32,
pix_height: u32,
) -> Result<(), Error>
pub async fn window_change( &self, col_width: u32, row_height: u32, pix_width: u32, pix_height: u32, ) -> Result<(), Error>
Inform the server that our window size has changed.
Sourcepub async fn agent_forward(&self, want_reply: bool) -> Result<(), Error>
pub async fn agent_forward(&self, want_reply: bool) -> Result<(), Error>
Inform the server that we will accept agent forwarding channels
Sourcepub async fn data<R: AsyncRead + Unpin>(&self, data: R) -> Result<(), Error>
pub async fn data<R: AsyncRead + Unpin>(&self, data: R) -> Result<(), Error>
Send data to a channel.
Sourcepub async fn extended_data<R: AsyncRead + Unpin>(
&self,
ext: u32,
data: R,
) -> Result<(), Error>
pub async fn extended_data<R: AsyncRead + Unpin>( &self, ext: u32, data: R, ) -> Result<(), Error>
Send data to a channel. The number of bytes added to the “sending pipeline” (to be processed by the event loop) is returned.
pub async fn eof(&self) -> Result<(), Error>
pub async fn exit_status(&self, exit_status: u32) -> Result<(), Error>
Sourcepub async fn wait(&mut self) -> Option<ChannelMsg>
pub async fn wait(&mut self) -> Option<ChannelMsg>
Awaits an incoming ChannelMsg, this method returns None if the channel has been closed.
Sourcepub fn into_stream(self) -> ChannelStream<S>
pub fn into_stream(self) -> ChannelStream<S>
Consume the Channel to produce a bidirectionnal stream,
sending and receiving ChannelMsg::Data as AsyncRead + AsyncWrite.
Sourcepub fn make_reader(&mut self) -> impl AsyncRead + '_
pub fn make_reader(&mut self) -> impl AsyncRead + '_
Make a reader for the Channel to receive ChannelMsg::Data
through the AsyncRead trait.
Sourcepub fn make_reader_ext(&mut self, ext: Option<u32>) -> impl AsyncRead + '_
pub fn make_reader_ext(&mut self, ext: Option<u32>) -> impl AsyncRead + '_
Make a reader for the Channel to receive ChannelMsg::Data or ChannelMsg::ExtendedData
depending on the ext parameter, through the AsyncRead trait.
Sourcepub fn make_writer(&self) -> impl AsyncWrite + 'static
pub fn make_writer(&self) -> impl AsyncWrite + 'static
Make a writer for the Channel to send ChannelMsg::Data
through the AsyncWrite trait.
Sourcepub fn make_writer_ext(&self, ext: Option<u32>) -> impl AsyncWrite + 'static
pub fn make_writer_ext(&self, ext: Option<u32>) -> impl AsyncWrite + 'static
Make a writer for the Channel to send ChannelMsg::Data or ChannelMsg::ExtendedData
depending on the ext parameter, through the AsyncWrite trait.