pub struct AudioRelation { /* private fields */ }Expand description
The directed “who may hear whom” relation, as the flavor declared it.
Accumulated during a render and compiled once at the end. Kept in terms of
ConnectionId because that is the vocabulary a flavor thinks in; the
translation to SessionId happens at compile time, against the view.
Implementations§
Source§impl AudioRelation
impl AudioRelation
Sourcepub fn domain(&mut self, domain: DomainId, members: &[ConnectionId])
pub fn domain(&mut self, domain: DomainId, members: &[ConnectionId])
Declare a symmetric group: every member hears every other member.
Repeated calls with the same domain accumulate members rather than replacing them, so a flavor may build a domain across several loops.
Sourcepub fn listen(&mut self, listener: ConnectionId, domain: DomainId)
pub fn listen(&mut self, listener: ConnectionId, domain: DomainId)
Declare a one-way exception: listener hears the domain, and is not
heard by it.
Sourcepub fn edge(&mut self, sender: ConnectionId, receiver: ConnectionId)
pub fn edge(&mut self, sender: ConnectionId, receiver: ConnectionId)
Declare a single directed edge.
Sourcepub fn domains(
&self,
) -> impl Iterator<Item = (DomainId, &BTreeSet<ConnectionId>)>
pub fn domains( &self, ) -> impl Iterator<Item = (DomainId, &BTreeSet<ConnectionId>)>
The members of each declared domain.
Sourcepub fn listeners(
&self,
) -> impl Iterator<Item = (ConnectionId, &BTreeSet<ConnectionId>)>
pub fn listeners( &self, ) -> impl Iterator<Item = (ConnectionId, &BTreeSet<ConnectionId>)>
Each listen declaration, paired with the domain’s members.
A listen on a domain that was never declared yields nothing: failing closed means a typo costs silence rather than a leak.
Sourcepub fn listen_declarations(
&self,
) -> impl Iterator<Item = (ConnectionId, DomainId)> + '_
pub fn listen_declarations( &self, ) -> impl Iterator<Item = (ConnectionId, DomainId)> + '_
Each listen declaration as written, including ones naming a domain that does not exist.
Sourcepub fn explicit_edges(
&self,
) -> impl Iterator<Item = (ConnectionId, ConnectionId)> + '_
pub fn explicit_edges( &self, ) -> impl Iterator<Item = (ConnectionId, ConnectionId)> + '_
The edges declared one at a time.
Sourcepub fn resolve(&self) -> BTreeSet<(ConnectionId, ConnectionId)>
pub fn resolve(&self) -> BTreeSet<(ConnectionId, ConnectionId)>
Every directed edge implied by the declarations, as (sender, receiver).
A member never hears itself: the client plays back its own voice locally, and echoing it from the server is the classic doubled-voice bug. The explicit server loopback target is a separate mechanism and is not a route.
This is the definition of the relation, and it materializes every
pair - which is quadratic for a full-mesh domain. Nothing on a shard’s
turn calls it: compile walks the same structure without a tree, and
the render’s own checks walk it by distinct scope. It stays because it
says plainly what the relation means, and a test pins compile to it.
Trait Implementations§
Source§impl Clone for AudioRelation
impl Clone for AudioRelation
Source§fn clone(&self) -> AudioRelation
fn clone(&self) -> AudioRelation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more