-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: Consider using AsRef<Path>
in SftpSession
#7
Comments
I'd actually argue that using paths might be misleading, at least if you use Rust's standard paths. This is because the path functionality you are using is associated with the client, not the server you are working with. For instance, you are on Windows and connecting to an ssh server on Linux. When you use something like In practicality, I don't think using |
You're fully correct, I forgot that EDIT: Just noticed that the newest version of that crate adds an enum type representing multiple possible path formats, maybe it could work after all 🤔 |
Yeah, made that just now to make it a little easier to abstract. For now, your code would need to match on the type to do anything more specific (access UnixPath or WindowsPath), but I'll add in a wrapper to support the bulk of the operations directly from |
Currently, all methods taking paths in
russh_sftp::client::SftpSession
take animpl Into<String>
.As these are actually all paths and my code treats these as paths, I find myself converting between strings and paths a lot.
I believe that it would make more sense to use
AsRef<Path>
for these methods instead, as this would also guarantee that the paths are valid on a type-level.Also, the methods use both
T
andP
for the generic path argument. Even if this request isn't implemented making those more consistent would be nice.The text was updated successfully, but these errors were encountered: