pub struct Gate<'a> {
pub requires_flags: &'a [FlagId],
pub forbids_flags: &'a [FlagId],
pub requires_state: &'a [StateCompare],
}Expand description
A gate, as one value: everything that decides whether the thing carrying it may happen.
Borrowed rather than owned, so gate() is free on every consumer and no
consumer has to store a second copy of its own fields.
Fields§
§requires_flags: &'a [FlagId]Flags that must all be set (DSL v0.3/v0.4).
forbids_flags: &'a [FlagId]Flags whose being set suppresses this (DSL v0.6).
requires_state: &'a [StateCompare]Numeric comparisons that must all hold (DSL v0.10, spec-0031).
Implementations§
Source§impl<'a> Gate<'a>
impl<'a> Gate<'a>
Sourcepub fn of(
requires_flags: &'a [FlagId],
forbids_flags: &'a [FlagId],
requires_state: &'a [StateCompare],
) -> Self
pub fn of( requires_flags: &'a [FlagId], forbids_flags: &'a [FlagId], requires_state: &'a [StateCompare], ) -> Self
Build a gate from its three fields. The one constructor, so a consumer that forgets a field is a rustc error rather than a silently narrower gate.
Source§impl Gate<'_>
impl Gate<'_>
Sourcepub fn contradiction(&self) -> Option<GateContradiction>
pub fn contradiction(&self) -> Option<GateContradiction>
The first reason this gate can NEVER open, or None for a satisfiable
gate.
A gate is a conjunction, so it is unsatisfiable exactly when one flag is on both lists, or one datum’s terms intersect to the empty set. Terms on distinct flags/datums are independent and cannot contradict each other.