pub struct VetoGate<const N: usize> { /* private fields */ }Expand description
A gate that is asserted while any of its N contributors holds it
and released only once all of them have let go.
The shape of a trip matrix or a safety chain: every protection function
writing the gate may force the safe state, and no single one can clear
another’s contribution. Writers declare writes: [crate::TRIP veto]; the
graph numbers them — one slot per node, one per pool member — and proves
at compile time that the target is a VetoGate with room for them all.
A writer takes its handle with TaskNode::veto and asserts or releases
its own bit; the actuator reads the gate through reads: and parks on
wait_asserted / wait_released.
A contributor’s bit stays asserted when its writer stops: a dead
protection function keeps the trip. Release is explicit — the writer’s
own Veto::release, or the application through
release_slot. Costs one AtomicU32 and one
Signal per gate (plus a transition counter under coupling-observe).
Implementations§
Source§impl<const N: usize> VetoGate<N>
impl<const N: usize> VetoGate<N>
Sourcepub fn is_asserted(&self) -> bool
pub fn is_asserted(&self) -> bool
Is any contributor holding the gate?
Sourcepub fn contributors(&self) -> u32
pub fn contributors(&self) -> u32
The contributors currently asserting, one bit per slot.
Sourcepub fn assert_slot(&self, slot: u8) -> bool
pub fn assert_slot(&self, slot: u8) -> bool
Assert contributor slot. Returns whether the gate flipped from
released to asserted.
Sourcepub fn release_slot(&self, slot: u8) -> bool
pub fn release_slot(&self, slot: u8) -> bool
Release contributor slot. Returns whether the gate flipped from
asserted to released — only once the last contributor lets go.
Sourcepub async fn wait_asserted(&self)
pub async fn wait_asserted(&self)
Park until the gate is asserted (returns at once if it already is).
Sourcepub async fn wait_released(&self)
pub async fn wait_released(&self)
Park until every contributor has released the gate.
Trait Implementations§
Source§impl<const N: usize> Observable for VetoGate<N>
Available on crate feature coupling-observe only.
impl<const N: usize> Observable for VetoGate<N>
coupling-observe only.