Giter Site home page Giter Site logo

Comments (6)

alexcrichton avatar alexcrichton commented on June 24, 2024

Currently these types are also provided by winapi (under mostly the same names), although I'd certainly believe that the experience is unfortunately a little painful!

Currently the scope of this library is just the CRT bindings, which I don't think includes these networking primitives, but it could be possible to perhaps expand the scope.

from libc.

dimbleby avatar dimbleby commented on June 24, 2024

I can see that "the CRT bindings" is a temptingly clean place at which to draw the line.

However, I'd argue that a more helpful approach would be: if it sensibly can be cross-platform, then make it cross-platform.

That is: if I could write C code using structure X (or value Y) and reasonably expect that such code would compile cross-platform - well then structure X (or value Y) should be available in Rust's libc.

I realise that where I write "sensibly", and "reasonably expect", I'm asking that someone make a judgement call; and that this is more difficult than defining a hard rule and sticking with it. But I'd propose that "being useful to people writing Rust" is a better guideline than "it depends on which header files Microsoft chose to put something in". So I'd favour expanding the scope of this library, where doing so meets that goal.

(Philosophy aside, I've noticed while writing this that I would like to add AF_INET and AF_INET6 to the list of things that my code actually cares about).

from libc.

alexcrichton avatar alexcrichton commented on June 24, 2024

Yeah it's true that drawing the line at the CRT is somewhat arbitrary, and this would certainly perhaps be useful to have!

I'm a little worried about feature creep here in the sense of what's the new line? Anything that happens to be defined on "most unix platforms" as well as Windows? That may end up working out in practice, but there's definitely pros and cons to having a hard line.

from libc.

dimbleby avatar dimbleby commented on June 24, 2024

Yep, agreed - though I'd hope that the particular things that I'm asking for in this issue lie towards the uncontroversial end of the spectrum.

Indeed, isn't Rust's own standard library going to want these structures for its implementation of Ipv4Addr and so on...?

from libc.

alexcrichton avatar alexcrichton commented on June 24, 2024

For an implementation detail, yeah, but for now we end up just defining everything on Windows ourselves (although in the future we'd like to use the winapi set of crates for this).

from libc.

alexcrichton avatar alexcrichton commented on June 24, 2024

The libs team discussed this during triage today and the decision was to hold the line for now at the CRT on Windows. We can always add these at a later date if it becomes necessary but for now using winapi + libc is the way to go.

from libc.

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.