This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
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.
This change is primarily motivated by Bevy's ecosystem standards - "features are additive".
If someone uses both the
server
andclient
feature in v0.1, they'd inherit two different types ofNetworkReader
andNetworkWriter
, one for a client, one for a server.The changes in this PR allow someone to use both features without name collision. The
NetworkReader
andNetworkReader
have been combined into a single type, now respectivelyRtcClient
orRtcServer
.In addition, this PR also solves a thorny borrow issue.
Now that
NetworkReader
andNetworkWriter
have been combined, the following was not possible on clients:This is because
.read()
takes&mut self
and so does.reliable_to_host()
. (2 mutable borrows)A minor change to address this was that the definition of
read()
changed on the client to return an ownedVec<M>
instead of aVecDeque<'_, M>
. The lifetime was problematic.