forked from StudioInfinity/dyna3
Compare commits
No commits in common. "7cbd92618b867fcf6d52cb755d454a492768c349" and "6c31a25822ca9d5b8dc3a50dc7ffac4e94f19afc" have entirely different histories.
7cbd92618b
...
6c31a25822
1 changed files with 5 additions and 9 deletions
|
@ -30,9 +30,6 @@ pub struct Element {
|
|||
pub label: String,
|
||||
pub color: ElementColor,
|
||||
pub representation: Signal<DVector<f64>>,
|
||||
|
||||
// the regulators that affect this element. the ambient assembly is
|
||||
// responsible for keeping this set up to date
|
||||
pub regulators: Signal<BTreeSet<RegulatorKey>>,
|
||||
|
||||
// a serial number, assigned by `Element::new`, that uniquely identifies
|
||||
|
@ -120,7 +117,7 @@ impl Element {
|
|||
|
||||
// to construct a `SpecifiedValue` that might be `Present`, use the associated
|
||||
// function `try_from`. this ensures that `spec` is always a valid specification
|
||||
// of `value` according to the format discussed at the implementation of
|
||||
// of `value` according to the format discussed above the implementation of
|
||||
// `TryFrom<String>`
|
||||
pub enum SpecifiedValue {
|
||||
Absent,
|
||||
|
@ -157,8 +154,7 @@ impl SpecifiedValue {
|
|||
// specification is empty, the `SpecifiedValue` is `Absent`. if the
|
||||
// specification parses to a floating-point value `x`, the `SpecifiedValue` is
|
||||
// `Present`, with a `value` of `x`, and the specification is stored in `spec`.
|
||||
// these are currently the only valid specifications; any other produces an
|
||||
// error
|
||||
// these are the only valid specifications; any other produces an error
|
||||
impl TryFrom<String> for SpecifiedValue {
|
||||
type Error = ParseFloatError;
|
||||
|
||||
|
@ -187,7 +183,7 @@ impl Regulator {
|
|||
self.set_point.set(set_pt);
|
||||
true
|
||||
}
|
||||
Err(_) => false
|
||||
Err(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +272,7 @@ impl Assembly {
|
|||
);
|
||||
}
|
||||
|
||||
fn insert_regulator(&self, regulator: Regulator) {
|
||||
pub fn insert_regulator(&self, regulator: Regulator) {
|
||||
let subjects = regulator.subjects;
|
||||
let key = self.regulators.update(|regs| regs.insert(regulator));
|
||||
let subject_regulators = self.elements.with(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue