Skip to main content

MeshTransport

Trait MeshTransport 

Source
pub trait MeshTransport {
    // Required methods
    fn broadcast(&mut self, data: &[u8]);
    fn poll(&mut self) -> Vec<(PeerId, Vec<u8>)>;
    fn events(&mut self) -> Vec<MeshEvent>;
}
Expand description

The transport seam: how the coordinator actually moves bytes between peers. The real implementation is WebRTC data channels (a feature-gated binding); tests use an in-memory loopback. Keeping this a trait is what makes the mesh logic testable with no network and swappable across transports.

Required Methods§

Source

fn broadcast(&mut self, data: &[u8])

Send data to every connected peer (unreliable/unordered is fine for poses).

Source

fn poll(&mut self) -> Vec<(PeerId, Vec<u8>)>

Drain inbound (sender, data) messages received since the last poll.

Source

fn events(&mut self) -> Vec<MeshEvent>

Drain peer connect/disconnect events since the last poll.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§