From 9c60f8247dfb86291933bbf556bc55dde90d7602 Mon Sep 17 00:00:00 2001 From: Maya the bee <15341887+Nurrl@users.noreply.github.com> Date: Thu, 21 Sep 2023 14:26:01 +0200 Subject: [PATCH] Downgrade &mut self references to &self in Channel methods --- russh/src/channels/mod.rs | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/russh/src/channels/mod.rs b/russh/src/channels/mod.rs index f07a918f..1b507f14 100644 --- a/russh/src/channels/mod.rs +++ b/russh/src/channels/mod.rs @@ -165,7 +165,7 @@ impl + Send + 'static> Channel { /// Request a pseudo-terminal with the given characteristics. #[allow(clippy::too_many_arguments)] // length checked pub async fn request_pty( - &mut self, + &self, want_reply: bool, term: &str, col_width: u32, @@ -188,7 +188,7 @@ impl + Send + 'static> Channel { } /// Request a remote shell. - pub async fn request_shell(&mut self, want_reply: bool) -> Result<(), Error> { + pub async fn request_shell(&self, want_reply: bool) -> Result<(), Error> { self.send_msg(ChannelMsg::RequestShell { want_reply }) .await?; Ok(()) @@ -197,11 +197,7 @@ impl + Send + 'static> Channel { /// 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). - pub async fn exec>>( - &mut self, - want_reply: bool, - command: A, - ) -> Result<(), Error> { + pub async fn exec>>(&self, want_reply: bool, command: A) -> Result<(), Error> { self.send_msg(ChannelMsg::Exec { want_reply, command: command.into(), @@ -211,14 +207,14 @@ impl + Send + 'static> Channel { } /// Signal a remote process. - pub async fn signal(&mut self, signal: Sig) -> Result<(), Error> { + pub async fn signal(&self, signal: Sig) -> Result<(), Error> { self.send_msg(ChannelMsg::Signal { signal }).await?; Ok(()) } /// Request the start of a subsystem with the given name. pub async fn request_subsystem>( - &mut self, + &self, want_reply: bool, name: A, ) -> Result<(), Error> { @@ -235,7 +231,7 @@ impl + Send + 'static> Channel { /// [RFC4254](https://tools.ietf.org/html/rfc4254#section-6.3.1) /// for security issues related to cookies. pub async fn request_x11, B: Into>( - &mut self, + &self, want_reply: bool, single_connection: bool, x11_authentication_protocol: A, @@ -255,7 +251,7 @@ impl + Send + 'static> Channel { /// Set a remote environment variable. pub async fn set_env, B: Into>( - &mut self, + &self, want_reply: bool, variable_name: A, variable_value: B, @@ -271,7 +267,7 @@ impl + Send + 'static> Channel { /// Inform the server that our window size has changed. pub async fn window_change( - &mut self, + &self, col_width: u32, row_height: u32, pix_width: u32, @@ -288,14 +284,14 @@ impl + Send + 'static> Channel { } /// Inform the server that we will accept agent forwarding channels - pub async fn agent_forward(&mut self, want_reply: bool) -> Result<(), Error> { + pub async fn agent_forward(&self, want_reply: bool) -> Result<(), Error> { self.send_msg(ChannelMsg::AgentForward { want_reply }) .await?; Ok(()) } /// Send data to a channel. - pub async fn data(&mut self, data: R) -> Result<(), Error> { + pub async fn data(&self, data: R) -> Result<(), Error> { self.send_data(None, data).await } @@ -303,7 +299,7 @@ impl + Send + 'static> Channel { /// "sending pipeline" (to be processed by the event loop) is /// returned. pub async fn extended_data( - &mut self, + &self, ext: u32, data: R, ) -> Result<(), Error> { @@ -311,7 +307,7 @@ impl + Send + 'static> Channel { } async fn send_data( - &mut self, + &self, ext: Option, mut data: R, ) -> Result<(), Error> { @@ -322,7 +318,7 @@ impl + Send + 'static> Channel { Ok(()) } - pub async fn eof(&mut self) -> Result<(), Error> { + pub async fn eof(&self) -> Result<(), Error> { self.send_msg(ChannelMsg::Eof).await?; Ok(()) }