Erase the const generics from the edge-nal-embassy types #78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The purpose of
edge-nal-embassyis to provide implementations for theedge-naltraits on top ofembassy-net.Therefore, the expectation is that the public struct types of
edge-nal-embassyfor TCP/UDP sockets would rarely be used and instead - the user would write their code against theedge-naltraits to achieve platform independence.Nevertheless - and especially if some of these types need to be put in a static context with embassy's
make_static!/mk_static!macros - the fact that the edge-nal-embassy types are so heavily generified with const generics is inconvenient, as the user has to type the full types, with theirN, TX_SZ, RX_SZ, Mgenerics.This PR is erasing all of the const generics (coming from the TCP/UDP buffers' pool) by using not the
Pooltype but rather, a new sealedDynPooltrait which - furthermore - is injected in theTcp/Udptypes and their sockets as a&dyntrait (hence its own type is also erased).As a result,
Tcp/Udp/TcpSocket/UdpSockethave now all their const generics removed and have just a single lifetime generic.Additionally,
Tcp,UdpandDnsare nowCopyjust like the underlying embassy-netStacktype for extra user convenience.