pub struct EffectManager { /* private fields */ }Implementations§
Source§impl EffectManager
impl EffectManager
pub fn new( registry: Arc<EffectRegistry>, rt_ctx: RuntimeContext, test_span: SpanId, ) -> Self
Sourcepub fn instantiate<'a>(
&'a self,
starts: &'a [IrEffectStart],
caller_vars: &'a VarScope,
caller_env: &'a Arc<LayeredEnv>,
parent_span: SpanId,
caller_captures: &'a HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<(ExportedEffect, EffectGuard)>, ExecError>> + Send + 'a>>
pub fn instantiate<'a>( &'a self, starts: &'a [IrEffectStart], caller_vars: &'a VarScope, caller_env: &'a Arc<LayeredEnv>, parent_span: SpanId, caller_captures: &'a HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<(ExportedEffect, EffectGuard)>, ExecError>> + Send + 'a>>
Acquire all starts, honoring the wait-set edges enrichment
derived from each start’s overlay (IrEffectStart::deps()).
caller_vars contains the caller’s accumulated variable scope,
allowing overlay expressions to reference the caller’s let bindings.
caller_env is the layered environment visible to the caller.
Returns one (ExportedEffect, EffectGuard) per start declaration,
in input order.
Scheduling: each start runs as its own future. A start whose
deps() is non-empty first awaits those sibling starts’ completion
signals (published over per-start watch channels); the ready
deps’ EXPOSED VARS are injected into the start’s scope under
Alias.var keys BEFORE its overlay is evaluated, so the overlay’s
QualifiedVar refs resolve. Independent starts (empty deps())
still bootstrap concurrently, exactly as before. Enrichment proved
the dep graph acyclic, so the wait-set awaits cannot deadlock.
The slot lock in acquire (see registry::EffectSlot) serialises
bootstrap-vs-reuse for the same dedup key, so parallel acquires of
overlapping keys are safe - one bootstraps, the others wait on the
slot’s Notify. Independent effects (different keys) bootstrap
truly in parallel. Overlay evaluation runs inside each start’s
future (concurrently): a start’s scope is fully materialized
(caller scope + resolved dep vars) BEFORE its pure overlay eval
runs, and pure eval has no cross-start side effects, so concurrent
evaluation cannot change any overlay’s value or its derived dedup
key.
Rollback stays all-or-nothing, generalized along dep edges: a
failed dep fails its dependents (recorded as DepFailed), and on
ANY failure every successful acquire is released concurrently
before the first root error propagates.
Sourcepub async fn instantiate_top_level(
&self,
starts: &[IrEffectStart],
caller_vars: &VarScope,
caller_env: &Arc<LayeredEnv>,
caller_captures: &HashMap<String, String>,
) -> Result<Vec<ExportedEffect>, ExecError>
pub async fn instantiate_top_level( &self, starts: &[IrEffectStart], caller_vars: &VarScope, caller_env: &Arc<LayeredEnv>, caller_captures: &HashMap<String, String>, ) -> Result<Vec<ExportedEffect>, ExecError>
Public top-level entry point used by the test runner. Acquires every
start in starts, stashes the resulting guards on the
EffectManager so cleanup_all can drain them, and returns the
shells/vars exports for the caller’s shell map.
Sourcepub async fn cleanup_all(&self) -> Vec<Warning>
pub async fn cleanup_all(&self) -> Vec<Warning>
Drain the test’s top-level guards and release each concurrently.
The slot mutex + refcount guarantee that for each dedup’d slot,
exactly one releaser sees refcount == 0 and runs the cleanup
body; other releasers return None and short-circuit.
Every EffectCleanup span opened here is parented under
self.test_span. Cleanups are operationally test-level activity
(scheduled at test teardown), and the EffectSetup span has
long since closed.
Auto Trait Implementations§
impl !Freeze for EffectManager
impl !RefUnwindSafe for EffectManager
impl !UnwindSafe for EffectManager
impl Send for EffectManager
impl Sync for EffectManager
impl Unpin for EffectManager
impl UnsafeUnpin for EffectManager
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);