Git Product home page Git Product logo

Comments (15)

Hoverbear avatar Hoverbear commented on May 18, 2024

You forgot UdpSocket in your strategy.

Do you think that the Error::from_os_error issue is something that should be discussed upstream? Surely mio will not be the only library with this concern.

from mio.

carllerche avatar carllerche commented on May 18, 2024

@Hoverbear I have mentioned it and I believe they will stabilize it, but not until 1.0 Final would be my guess. If std::io::Error was the only issue, it wouldn't be worth changing anything. However, this change would be required to get Mio running on windows. So, I was hoping to postpone the change, but the std::io::Error issue is bringing it up now.

from mio.

reem avatar reem commented on May 18, 2024

I would rather stay on nightlies and use the std types with unstable APIs, if that's possible. I don't think it's actually crucial we get this building on stable rust at 1.0, since it is in a highly experimental area of rust development.

from mio.

Hoverbear avatar Hoverbear commented on May 18, 2024

Requiring nightlies after 1.0 would greatly limit mio's audience.

from mio.

CraZySacX avatar CraZySacX commented on May 18, 2024

I like the idea of one library that support the same platforms rust itself supports over using the std types.

from mio.

zslayton avatar zslayton commented on May 18, 2024

I'm in favor of this; at the moment lack of Windows support is the only thing keeping me from using mio for a handful of side projects. It would be great to have platform parity with rustc.

from mio.

rozaliev avatar rozaliev commented on May 18, 2024

We are using mio in a couple of projects. All of them will stay on nightlies after 1.0, at least until compiler plugins are stable. Windows support is not important for us, but I guess it would be nice to have for some people. (without additional overhead for *nix part).

But there are some things that I would prefer be different. After last mio reform my colleagues asked me a lot of questions about code like this

match sock.read_slice(...) {
                Ok(Some(n)) => { .. },
                Ok(None) => { .. },
                Err(e) => { .. },
            }

It's very confusing and non intuitive. I believe Option is not ideal way of communicating WouldBlock.

Smth like this would be great.

match sock.read_slice(...) {
                Ok(n) => { .. },
                Err(Mio::WouldBlock) => { .. },
                Err(Mio::Eof) => { .. },
                Err(e) => { .. },
            }

Explicit eof instead of n == 0 would be great too.

With Result<_, mio::Error> it will be possible again.

from mio.

carllerche avatar carllerche commented on May 18, 2024

@rozaliev I thought a bunch about how to communicate WouldBlock, and IMO the issue is that, when working with non-blocking sockets, a WouldBlock case is not actually an error. The reason this matters is, if using try!(sock.read_slice(...)), a WouldBlock would end up returning early from the function.

If all mio sockets are assumed to be non-blocking, NonBlock could be repurposed as it was in 0.2:

match sock.read_slice(...) {
    Ok(NonBlocK::Ready(n)) => { .. },
    Ok(NonBlock::WouldBlock) => { .. },
    Err(e) => { .. },
}

from mio.

reem avatar reem commented on May 18, 2024

I personally would prefer if we reused Option, as it reduces imports and is more compatible with other code that already operates on Option values.

from mio.

carllerche avatar carllerche commented on May 18, 2024

I think I also personally prefer the Option signature, but it is open for discussion :)

Anyway, got Mio running on Rust 1.0 beta w/o these changes, so there isn't a huge rush now. I think version 0.4.0 will target windows support, which will require some of what I proposed initially. I'll try to post a more in depth windows support plan when I have a moment.

from mio.

zslayton avatar zslayton commented on May 18, 2024

Out of interest, what would TcpStream and friends look like if they were moved into mio? Would it still be possible to read/write to them in a synchronous fashion if needed?

from mio.

carllerche avatar carllerche commented on May 18, 2024

The versions in mio would probably be hard coded to be non-blocking. However, there could be conversions between mio::TcpStream and std::net::TcpStream and the mio EventLoop could support registering std::net::TcpStream (and others), but only on posix systems.

from mio.

jnicholls avatar jnicholls commented on May 18, 2024

Would this affect Mio's ability to interoperate with openssl crate's SslStream<S> for example? Actually, is that even possible today for Mio to event on an SslStream<S> type?

from mio.

carllerche avatar carllerche commented on May 18, 2024

@jnicholls It shouldn't make it harder. I believe it would be possible for Mio to work w/ a non-block SSL stream type. We could discuss it further on the #mio IRC channel.

from mio.

carllerche avatar carllerche commented on May 18, 2024

I'm going to close this in favor of #155. Trying to keep things clean...

from mio.

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.