pub struct Topology {
pub fixtures: BTreeMap<FixtureId, Fixture>,
pub default_layout: Layout,
pub edges: BiMap<FixtureId, FixtureId>,
pub ports: BTreeMap<FixtureId, Port>,
}Expand description
The default layout plus how the fixtures are connected to ports and in which order. One per project.
Fields§
§fixtures: BTreeMap<FixtureId, Fixture>§default_layout: LayoutNecessarily contains every fixture — the patching topology cannot be
defined otherwise. Maintained by add_fixture/remove_fixture.
edges: BiMap<FixtureId, FixtureId>Directed parent → child edges. A fixture that is nobody’s child is a chain head and owns a port.
ports: BTreeMap<FixtureId, Port>Implementations§
Source§impl Topology
impl Topology
pub fn add_fixture( &mut self, fixture: Fixture, position: LayoutPosition, ) -> FixtureId
Sourcepub fn remove_fixture(&mut self, id: FixtureId, layouts: &mut [Layout])
pub fn remove_fixture(&mut self, id: FixtureId, layouts: &mut [Layout])
Removes a fixture everywhere: from the topology, its chain, and every user layout.
Sourcepub fn make_leaf(&mut self, id: FixtureId)
pub fn make_leaf(&mut self, id: FixtureId)
Detaches whatever follows id, making that successor a chain head.
Sourcepub fn chain_head_of(&self, id: FixtureId) -> FixtureId
pub fn chain_head_of(&self, id: FixtureId) -> FixtureId
The head of the chain id belongs to.
Sourcepub fn make_successor(&mut self, parent: FixtureId, child: FixtureId) -> bool
pub fn make_successor(&mut self, parent: FixtureId, child: FixtureId) -> bool
Connects child after parent. Rejected if it would form a cycle.
A chain’s network output belongs to the chain, not to the fixture that happens to be first: putting a new fixture in front of a chain carries the port’s settings over to it.
pub fn is_chain_head(&self, id: FixtureId) -> bool
pub fn successor(&self, id: FixtureId) -> Option<FixtureId>
Sourcepub fn chain_from(&self, head: FixtureId) -> Vec<FixtureId>
pub fn chain_from(&self, head: FixtureId) -> Vec<FixtureId>
Every fixture from head down its chain, head first.
pub fn chain_heads(&self) -> Vec<FixtureId>
Sourcepub fn is_reachable(&self, start: FixtureId, target: FixtureId) -> bool
pub fn is_reachable(&self, start: FixtureId, target: FixtureId) -> bool
true if target is reachable from start by following parent →
child edges. Used to keep connections acyclic.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Topology
impl<'de> Deserialize<'de> for Topology
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Topology
Auto Trait Implementations§
impl Freeze for Topology
impl RefUnwindSafe for Topology
impl Send for Topology
impl Sync for Topology
impl Unpin for Topology
impl UnsafeUnpin for Topology
impl UnwindSafe for Topology
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,
impl<T> DebugAny for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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