GithubHelp home page GithubHelp logo

Comments (5)

veeso avatar veeso commented on May 23, 2024 1

That's a good point. Made it public in 5.1.1

from suppaftp.

veeso avatar veeso commented on May 23, 2024 1

Probably a trait would be needed, but it's not that easy to implement here.

Anyway at the time I didn't think much about your request, but there's no need to use the plain FTP stream if secure is enabled. You can just use the RustlsFtpStream or NativeTlsFtpStream and call into_secure only if secure = true

from suppaftp.

svet-b avatar svet-b commented on May 23, 2024

Thanks a lot for the quick response to this! I had a go at doing what I need to do with the new version but somehow didn't quite get it to work. I'm sure this will expose my ignorance when it comes to some Rust concepts, but since ImplFtpStream is actually a struct and not a trait, I'm not able to use it as a dyn type.

Is there a way to write code that will set up an ftp_stream that is generic over ImplFtpStream (regardless of whether the encapsulated stream is secure or not) and can then carry out the login() and other methods that are common to both types of connection? Sorry if I'm missing something simple...

from suppaftp.

svet-b avatar svet-b commented on May 23, 2024

FWIW I wrote a bit about my attempts to do this, and got some advice on the user forum here: https://users.rust-lang.org/t/more-elegant-way-to-call-generic-methods-on-a-struct/92397

from suppaftp.

svet-b avatar svet-b commented on May 23, 2024

Oh wow, that's a very good point! Didn't occur to me to try that at all. Seems to work perfectly also.

from suppaftp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.