Comments (6)
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.
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.
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.
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.
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.
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)
- Unsound `impl Debug for <union>` (in `src/unix/linux_like/android/mod.rs`) HOT 1
- main branch no longer implicitly enables const-extern-fn HOT 1
- Add missing definitions from linux/include/uapi/linux/netfilter/nf_tables.h HOT 1
- Missing Elf64_Rela type
- seg fault when compiling with `--features extra_traits` HOT 1
- CLONE_INTO_CGROUP and CLONE_CLEAR_SIGHAND are both erroneously 0
- Require support for inet_* API HOT 4
- memfd_create on android api level 30 and above
- libc does not seem to respect the CC environment variable
- [libc-0.2] `posix_spawn_file_actions_t` cannot be used on Linux after #3602 HOT 10
- Why in6_ifreq does not exist on macOS
- [libc-0.2] CI broken--pthread_getname_np linking failure in musl HOT 4
- Signal types missing for some embedded targets HOT 4
- Missing SIOC ioctl constants on MacOS
- POSIX_SPAWN_* flags have incorrect type
- `Cargo test` runs 0 test cases for this crate, and `cargo test -p libc-test` results in error in linux.
- Libc-test fails on linux due to Undeclared symbols Elf32_Relr and Elf64_Relr HOT 4
- The offset of mcontext_t inside the libc::ucontext_t struct is incorrect HOT 1
- Why not use OwnedFd and BorrowFd instead of RawFd for fd params? HOT 1
- DNS configuration API on macOS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libc.