Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

v0.2.0 - split server/client types #12

Merged
merged 3 commits into from
Apr 8, 2024
Merged

v0.2.0 - split server/client types #12

merged 3 commits into from
Apr 8, 2024

Conversation

simbleau
Copy link
Member

@simbleau simbleau commented Apr 8, 2024

This change is primarily motivated by Bevy's ecosystem standards - "features are additive".
image

If someone uses both the server and client feature in v0.1, they'd inherit two different types of NetworkReader and NetworkWriter, one for a client, one for a server.

The changes in this PR allow someone to use both features without name collision. The NetworkReader and NetworkReader have been combined into a single type, now respectively RtcClient or RtcServer.

In addition, this PR also solves a thorny borrow issue.
Now that NetworkReader and NetworkWriter have been combined, the following was not possible on clients:

for .. in client.read() {
    client.reliable_to_host(..)
}

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 owned Vec<M> instead of a VecDeque<'_, M>. The lifetime was problematic.

@simbleau simbleau merged commit a070750 into main Apr 8, 2024
4 checks passed
@simbleau simbleau deleted the v0.2.0 branch April 8, 2024 17:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant