pub struct SimulationChecksum(pub u64);Expand description
XOR rolling checksum of the entire physics state.
Computed from position + velocity + rotation of all bodies. Two simulations with identical inputs will produce identical checksums.
Tuple Fields§
§0: u64Implementations§
Source§impl SimulationChecksum
impl SimulationChecksum
Sourcepub fn from_world(world: &PhysicsWorld) -> Self
pub fn from_world(world: &PhysicsWorld) -> Self
Compute checksum from current world state.
Uses XOR-rotate mixing per body for O(n) computation. Avalanche mixing ensures single-bit differences propagate.
§被覆は serialize_state の blob に従う (単一源化、B-13)
旧実装は field を手で並べており、position は .hi + .lo、velocity と
rotation は .hi だけ、angular_velocity は 1 語も混ぜていなかった
208 byte/body のうち 角速度 48 byte + 小数語 56 byte が盲点で、
「角速度が完全に別の 2 世界」「velocity.y が 1 ulp 違う 2 世界」が
いずれも同一 checksum になる = desync 検出が false green になりうる
(tests/wm08_checksum_coverage.rs が red を実測してから置換した)
検証の道具が状態の被覆より狭いのが原因なので、blob の全 byte から
導出して被覆の定義を 1 箇所にした ⇒ 以後 serialize_state に state を
足すと checksum も自動で追従する (盲点が構造的に生まれない)
⚠️ checksum の値は旧実装と変わる 同一 version 同士の比較にのみ使う こと (lockstep の peer 間で version を混ぜない)
Trait Implementations§
Source§impl Clone for SimulationChecksum
impl Clone for SimulationChecksum
impl Copy for SimulationChecksum
Source§impl Debug for SimulationChecksum
impl Debug for SimulationChecksum
impl Eq for SimulationChecksum
Source§impl PartialEq for SimulationChecksum
impl PartialEq for SimulationChecksum
impl StructuralPartialEq for SimulationChecksum
Auto Trait Implementations§
impl Freeze for SimulationChecksum
impl RefUnwindSafe for SimulationChecksum
impl Send for SimulationChecksum
impl Sync for SimulationChecksum
impl Unpin for SimulationChecksum
impl UnsafeUnpin for SimulationChecksum
impl UnwindSafe for SimulationChecksum
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more