Skip to content

Branch dev/sftp-start: Issue deriving SSHEncode/Decode caused by a references to crate::sshwire:: in macro expansion #28

@jubeormk1

Description

@jubeormk1

Hi there,

I have been looking at your progress with the SFTP module and it looks great. While I was getting familiar with it I tried to solve a recurring error: Every time #[derive(Debug, SSHEncode, SSHDecode)] is added to a struct in sunset/sftp/src/proto.rs the next error is thrown by cargo check`:

error[E0432]: unresolved import `sshwire`
 --> sftp/src/proto.rs:3:5
  |
3 | use sshwire::{BinString, TextString, SSHEncode, SSHDecode, SSHSource, SSHSink, WireResult, WireError};
  |     ^^^^^^^ help: a similar path exists: `sunset::sshwire`

It look like when the derive macro is expanded it includes a references to crate::sshwire::SSHDecode::dec(s)?; and crate::sshwire::SSHEncode::enc(s)?; and because of that it is not able to reference properly sshwire.

Thinking about it, a way to start fixing this would be to extract sshwire from the main crate module and adding it to its own workspace module. Since sshwire.rs depends on error.rs and error.rs uses crate::channel::ChanNum, with this approach error.rs and a small portion of cannel.rs would need to be extracted too, causing a significant refactor in the whole project. There might be a better way to do this.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions