Skip to content

Commit

Permalink
Extension::parse doesn't require mutability
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Gautier <[email protected]>
  • Loading branch information
baloo committed Apr 24, 2024
1 parent ddf404e commit 0de8a59
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions examples/key_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,7 @@ impl Session for KeyStorage {
Ok(())
}

async fn extension(
&mut self,
mut extension: Extension,
) -> Result<Option<Extension>, AgentError> {
async fn extension(&mut self, extension: Extension) -> Result<Option<Extension>, AgentError> {
info!("Extension: {extension:?}");

match extension.name.as_str() {
Expand Down
4 changes: 2 additions & 2 deletions src/proto/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ impl Extension {
/// If there is a mismatch between the extension name
/// and the [`MessageExtension::NAME`], this method
/// will return [`None`]
pub fn parse_message<T>(&mut self) -> std::result::Result<Option<T>, <T as Decode>::Error>
pub fn parse_message<T>(&self) -> std::result::Result<Option<T>, <T as Decode>::Error>
where
T: MessageExtension + Decode,
{
Expand Down Expand Up @@ -638,7 +638,7 @@ pub struct Unparsed(pub Vec<u8>);

impl Unparsed {
/// Decode unparsed bytes as SSH structures.
pub fn parse<T>(&mut self) -> std::result::Result<T, <T as Decode>::Error>
pub fn parse<T>(&self) -> std::result::Result<T, <T as Decode>::Error>
where
T: Decode,
{
Expand Down

0 comments on commit 0de8a59

Please sign in to comment.