-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split up edge-net into smaller crates #10
Conversation
Fair enough.
Fair enough.
All std types except the A detail but still: all crates should also have a usable subset which only relies on
As per above, though with a different name maybe. A little but annoying detail: This is necessary for the http server only, yet kinda important. So the "std" code also has such sample traits and their implementation on top of async-io, but I consider this situation temporary, as ultimately, these need to be merged in the nal crate - in one form or another.
I think it does not make sense to have a crate for that. We should rather fork/PR the
This is a short term, tactical problem, fortunately. Let me look at the PR...
Ditto - let me look at the PR.
Fair enough. |
Regarding the "std" stuff - and putting aside the serverside TCP socket traits - it is essentially identical in spirit to this crate: I'm not sure why the crate from above ^^^ has dependencies on all of Anyway. Perhaps we can even convince the maintainer of the above stuff to (optionally) remove the |
@chrysn if I may ask for your opinion on this (i.e. trying to make |
I'm not sure I get the question. std-embedded-nal-async is just a provider of implementations of embedded-nal-async, and all that's in here is building on embedded-nal-async. That it uses async-std should be purely an imlpementation detail, and should have no bearing on its users. |
@chrysn The question is: are you open to changes of There are good reasons for that. As in some STD environments only having support for |
I'm certainly open to altering the implementation -- and that UnconnectedUdp is already implemented w/o async_std shows that it can be done. What I'm curious about is:
|
The Rust STD support for ESP IDF (i.e.
I'm digressing, but next tokio will support it too, but this version of tokio is not yet released at
It doesn't. And it won't do any assumptions about the underlying implementation. However, If I want to run any crate that depends on So in a way, if you reduce the dependencies of your crate to the bare minimum (say, Also, I - for one - am interested in using these tiny crates that come from the MCU Rust world in "STD" scenarios like embedded Linux as well. Why not? And it is not just a case of "this MCU guy knows his MCU echosystem and just wants to re-use it with STD", I hope. For one, |
Ah, this is about ESP. As for that: As std has no async implementation of sockets, std-embedded-nal-async (where it is not using async-std) is using the
(Long story short: Yes, let's do it, but not if 90% of the code become ifdef'd -- in that case, it'd be better to have a dedicated ESP implementation). As for using this on Linux: Yes, that's what std-embedded-nal is for, and can support well either way.
Full agree. The embedded-nal-async UDP is how I'd wish UDP sockets behaved everywhere. For example, that's how I'm using it for CoAP even on large systems. |
Just to be crystal clear though I suspect it is obvious: one cannot have "async" sockets with only something like (Mr Obvious again, but "STD" sockets are posix sockets of course, as you can always get their "raw fd" and call unsafe posix functions on these.) W.r.t.
...all do compile fine with If a future incarnation of
One small problem with
That should be possible. But I think your current approach is solid - drop to raw Posix API's only where you cannot go via the
As I mentioned, safe bets are:
Hopefully not.
We are aligned here. |
No, it's async-io plus nix.
Nice, I'd love to have some of them (link-layer? IP? both?) in embedded-nal-async! To go forward, looks like the best path would be to go async-io plus rustix. As I don't have any experience with that, do you think you could check whether the parts of std-embedded-nal-async's |
I think it actually does have the pktinfo stuff? In fact, I would dare say
I don't see why not both. In a way, what you get is specified when you do the
I'll put some effort into this. Might take a few days or even a week, so please bear with me. Need to finish this DHCP stuff first... |
libc has pktinfo alright, but only on platforms that really have it. (For example, Windows does have some kind of recvmsg / pktinfo, but it's weird, very unlike the POSIX way, and therefore currently unsupported in socket2).
Much appreciated! |
@bugadani I'll be pushing a lot of changes to the Once you do, I'll merge it in mainline and we'll continue fixing / ironing out from there. |
438b898
to
f21c1a3
Compare
Seeing this closed, where do we continue the side discussion on std-embedded-nal? Would you mind creating an issue over at https://gitlab.com/chrysn/std-embedded-nal? |
Just did. |
I'm putting this up early because I want to hear feedback about the general direction. As it is, the PR probably won't pass CI.
embassy-net
is now a thin facade crate reexporting the others, and also containing somestd
implementations.std
is a bit of a mystery still, as some parts can be implemented easily in their respective crates (captive's server, TcpAcceptor, etc.), butStdRawMutex
for example is a bit of a misfit. Maybe it would make sense to move all std-related code (except error type impls...) intoedge-std
or something similar.Compared to the original plans I had to create
edge-tcp
which only contains traits (and may contain the std implementation, except then I don't know where to put the std UDP impl).Some crates only make sense with nightly enabled because they only contain async implementations. Current code doesn't perfectly reflect this - I still want to put implementations behind feature gates just like in the current edge-net, so that they remain consistent and we don't take place away from possible blocking impls.
websocket's http-related additions are now in an extension trait so there's no http --> websocket dependency.
I also found a bunch of unused code in an unreachable utils module.
io
was maybe usable, but unreachable and I didn't find much reason to keep it.