pub struct MeshCoordinator { /* private fields */ }Expand description
The socket-free P2P mesh coordinator: peer-set management + pose fan-out +
feeding received poses into PresenceState. Tier-1 presence, no server.
Implementations§
Source§impl MeshCoordinator
impl MeshCoordinator
pub fn new(me: PeerId) -> Self
Sourcepub fn set_id(&mut self, id: PeerId)
pub fn set_id(&mut self, id: PeerId)
Adopt a server-assigned id (a rendezvous welcome{id}), replacing the
provisional self-picked one. The rendezvous sends welcome before peers,
so this lands before any peer connection exists.
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Number of connected peers (excludes self).
Sourcepub fn is_full(&self) -> bool
pub fn is_full(&self) -> bool
Whether the mesh is at capacity — a world should upgrade to a relay past this.
Sourcepub fn send_pose(
&self,
tx: &mut dyn MeshTransport,
pos: [f32; 3],
rot: [f32; 4],
vel: [f32; 3],
anim: u8,
ts: u32,
)
pub fn send_pose( &self, tx: &mut dyn MeshTransport, pos: [f32; 3], rot: [f32; 4], vel: [f32; 3], anim: u8, ts: u32, )
Broadcast the local player’s pose to all peers. ts is the sender’s clock.
Sourcepub fn pump(
&mut self,
tx: &mut dyn MeshTransport,
presence: &mut PresenceState,
now_ms: u64,
)
pub fn pump( &mut self, tx: &mut dyn MeshTransport, presence: &mut PresenceState, now_ms: u64, )
Pump the transport once: apply connect/disconnect events and decode inbound
peer poses into presence. Poses are stamped with the local now_ms (like
the relay client) so interpolation uses one clock and cross-peer skew is a
non-issue.