naia-lib / naia

a cross-platform (including Wasm!) networking library built in Rust. Intended to make multiplayer game development dead-simple & lightning-fast
Apache License 2.0
878 stars 58 forks source link

Add replicate for tuple structs #115

Closed cBournhonesque closed 1 year ago

cBournhonesque commented 1 year ago

Context

This PR is mostly for usability. There are a lot of components that I want to replicate that are wrapper or tuple structs, such as:

#[derive(Component, Replicate)]
pub struct Velocity_(pub Property<f32>)

Deriving Replicate on those structs was failing because Replicate only handled named structs. I updated the Replicatederive logic to handle structs that have unnamed fields.

Test

Added a unit test similar to the named struct one

connorcarpenter commented 1 year ago

Awesome! Merged into Release 0.15 (https://github.com/naia-lib/naia/pull/130). Thank you!