Implementing a small server which allows users to upload files to directories ( straightforward, no magic :grin: ) I found myself coding the translation between OpenFlags and tokio::fs::OpenOptions.
They pretty much match up, so I think implementing From between those types would be a nice usability enhancement. I noticed that russh-sftp does not have the tokio fs feature enabled (totally correct), so instead I went ahead implementing From<OpenFlags> for std::fs::OpenOptions, there is a From<std::fs::OpenOptions> for tokio::fs::OpenOptions in tokio.
I think this still keeps the nice usability, only an extra call to .into() without having to worry about implementation details. And it does not require any other change to russh-sftp.
The only downside I see would be targeting non-std environments, but I don't think this is a concern for russh-sftp?
Greets!
Implementing a small server which allows users to upload files to directories ( straightforward, no magic :grin: ) I found myself coding the translation between
OpenFlags
andtokio::fs::OpenOptions
.They pretty much match up, so I think implementing
From
between those types would be a nice usability enhancement. I noticed that russh-sftp does not have the tokio fs feature enabled (totally correct), so instead I went ahead implementingFrom<OpenFlags> for std::fs::OpenOptions
, there is aFrom<std::fs::OpenOptions> for tokio::fs::OpenOptions
in tokio.I think this still keeps the nice usability, only an extra call to
.into()
without having to worry about implementation details. And it does not require any other change torussh-sftp
.The only downside I see would be targeting non-std environments, but I don't think this is a concern for russh-sftp?
Have a nice day! Christoph