Struct async_gate::Lever
source · pub struct Lever { /* private fields */ }
Expand description
A lever that can [raise
] and [lower
] the gate it’s associated with
Implementations§
source§impl Lever
impl Lever
sourcepub fn raise(&self) -> Result<(), GateDropped>
pub fn raise(&self) -> Result<(), GateDropped>
Raise the gate.
This wakes all tasks waiting on Gate::raised
(and later calls to it will resolve immediately until the gate is [lower
]ed).
sourcepub fn lower(&self) -> Result<(), GateDropped>
pub fn lower(&self) -> Result<(), GateDropped>
Lower the gate.
This wakes all tasks waiting on Gate::lowered
(and later calls to it will resolve immediately until the gate is [raise
]d).
sourcepub fn is_raised(&self) -> Result<bool, BeforeGateDropped>
pub fn is_raised(&self) -> Result<bool, BeforeGateDropped>
Returns Ok(true)
if the gate is raised and Ok(false)
if it’s lowered,
or Err(BeforeGateDropped(true))
if the gate was dropped and was raised before dropping
and Err(BeforeGateDropped(false))
if the gate was dropped and was lowered before dropping.
sourcepub fn is_lowered(&self) -> Result<bool, BeforeGateDropped>
pub fn is_lowered(&self) -> Result<bool, BeforeGateDropped>
Returns Ok(true)
if the gate is lowered and Ok(false)
if it’s raised,
or Err(BeforeGateDropped(true))
if the gate was dropped and was lowered before dropping
and Err(BeforeGateDropped(false))
if the gate was dropped and was raised before dropping.
sourcepub fn gate_was_dropped(&self) -> bool
pub fn gate_was_dropped(&self) -> bool
Returns true
if the gate associated with this lever has been dropped
and false
if it hasn’t.