Skip to content

Instantly share code, notes, and snippets.

@boustrophedon
Created June 11, 2016 20:16
Show Gist options
  • Save boustrophedon/11bb8d76702e3e6ed4b33c4ba8ad8273 to your computer and use it in GitHub Desktop.
Save boustrophedon/11bb8d76702e3e6ed4b33c4ba8ad8273 to your computer and use it in GitHub Desktop.
struct Entity {
pub id: usize,
pub ver: usize,
}
impl Eq for Entity {
fn eq(self, other: Entity) {
return (self.id == other.id) && (self.ver == other.ver);
}
}
// the point of ver is that if we reuse an id, and a new one is allocated on the server
// with the same id as an old one that still is being used on the local world
// then the ver of the one on the server will be different because we keep track of the versions in a hashmap
// on the server, i guess?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment