pub struct ActionDag { /* private fields */ }Expand description
An ordered dependency graph over a program’s Actions.
Nodes preserve source order via ActionNode::ordinal; edges point from a
definition (a let or measure binding, or a resolve of a selective block)
to each consumer. Timing is not stored; compiler scheduling also uses graph
topology.
Implementations§
Source§impl ActionDag
impl ActionDag
Sourcepub fn to_svg(&self) -> Result<String, BlockGraphError>
pub fn to_svg(&self) -> Result<String, BlockGraphError>
Renders the stored action DAG as a self-contained SVG.
Nodes retain source ordinals and complete action text. Solid arrows show
classical variable dependencies, while dashed arrows show dependencies
inferred from correlation support. Edge titles identify their reasons.
Rendering does not derive missing dependencies or assign execution times.
Call crate::BlockGraph::analyze_action_graph first for an analyzed view.
The SVG uses the same layout as the physical IR dependency view.
§Errors
Returns an error for invalid action syntax, unresolved names or a cycle. No geometry audit or stabilizer analysis is performed during rendering.
use bloq_graph::GalleryItem;
let source = GalleryItem::T.build();
let dag = source.analyze_action_graph()?;
let svg = dag.to_svg()?;
assert!(svg.contains("mzz"));Source§impl ActionDag
impl ActionDag
Sourcepub fn resolve_sites_for_measurement(&self, name: &str) -> Option<Vec<IVec3>>
pub fn resolve_sites_for_measurement(&self, name: &str) -> Option<Vec<IVec3>>
Selective fills needed by this named readout, in coordinate order.
Returns None when the measurement is not in this action graph.
Sourcepub fn from_actions(actions: &[Action]) -> Self
pub fn from_actions(actions: &[Action]) -> Self
Builds the DAG from actions in source order, wiring dependency edges from each variable, measurement, or resolve definition to its uses.
Sourcepub fn inputs(&self) -> impl Iterator<Item = &str>
pub fn inputs(&self) -> impl Iterator<Item = &str>
External Boolean names accepted by this action program.
Sourcepub fn ordered_nodes(&self) -> impl Iterator<Item = &ActionNode>
pub fn ordered_nodes(&self) -> impl Iterator<Item = &ActionNode>
Iterates over nodes in source order.
Sourcepub fn dependencies(
&self,
) -> impl Iterator<Item = (usize, usize, ActionDependency)> + '_
pub fn dependencies( &self, ) -> impl Iterator<Item = (usize, usize, ActionDependency)> + '_
Iterates over dependency edges as (predecessor ordinal, consumer ordinal, reason).
Sourcepub const fn is_analyzed(&self) -> bool
pub const fn is_analyzed(&self) -> bool
Whether correlation-derived dependencies are current. An empty program has nothing to derive.
Sourcepub fn node_by_ordinal(&self, ordinal: usize) -> Option<&ActionNode>
pub fn node_by_ordinal(&self, ordinal: usize) -> Option<&ActionNode>
Returns the node at the given source ordinal, if any.
Sourcepub fn depends_on(&self, node: &ActionNode, pred_ordinal: usize) -> bool
pub fn depends_on(&self, node: &ActionNode, pred_ordinal: usize) -> bool
Returns whether node has a direct dependency edge from the action at
pred_ordinal.
Sourcepub fn resolve_value_domain(
&self,
targets: &[IVec3],
) -> Result<ResolveValueDomain, BooleanResourceError>
pub fn resolve_value_domain( &self, targets: &[IVec3], ) -> Result<ResolveValueDomain, BooleanResourceError>
Builds the exact distinct resolve-value domain at targets, following
Let bindings. A reduced shared decision diagram avoids enumerating the
measurement inputs; materializing the output domain can still be
exponential when that many distinct tuples are genuinely reachable.
A missing or cyclic resolve target has an empty domain.
§Errors
Returns an error if Boolean construction or enumeration exceeds its budget.
Sourcepub fn resolve_value_domain_bounded(
&self,
targets: &[IVec3],
limit: usize,
) -> Result<ResolveValueDomain, ResolveDomainError>
pub fn resolve_value_domain_bounded( &self, targets: &[IVec3], limit: usize, ) -> Result<ResolveValueDomain, ResolveDomainError>
Builds the exact resolve-value domain when it contains at most limit
distinct tuples.
§Errors
Returns Boolean resource exhaustion or the first observed size above
limit instead of truncating the domain.
Sourcepub fn resolve_value_domain_bounded_with_limits(
&self,
targets: &[IVec3],
limit: usize,
boolean_limits: BooleanLimits,
) -> Result<ResolveValueDomain, ResolveDomainError>
pub fn resolve_value_domain_bounded_with_limits( &self, targets: &[IVec3], limit: usize, boolean_limits: BooleanLimits, ) -> Result<ResolveValueDomain, ResolveDomainError>
Query a bounded output domain with an explicit Boolean work/allocation budget.
§Errors
Returns resource exhaustion or the first domain size above limit.
Sourcepub fn resolve_values_are_reachable(
&self,
targets: &[IVec3],
values: &[bool],
) -> Result<bool, BooleanResourceError>
pub fn resolve_values_are_reachable( &self, targets: &[IVec3], values: &[bool], ) -> Result<bool, BooleanResourceError>
Whether values is jointly reachable for targets, decided
symbolically without materializing the full output domain. Missing or
cyclic targets and mismatched slice lengths are not reachable.
§Errors
Returns an error if Boolean construction or evaluation exceeds its budget.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ActionDag
impl RefUnwindSafe for ActionDag
impl Send for ActionDag
impl Sync for ActionDag
impl Unpin for ActionDag
impl UnsafeUnpin for ActionDag
impl UnwindSafe for ActionDag
Blanket Implementations§
§impl<T, BorrowedSelf> BitwiseMutViaBorrow<BorrowedSelf> for T
impl<T, BorrowedSelf> BitwiseMutViaBorrow<BorrowedSelf> for T
fn assign_index(&mut self, index: usize, to: bool)
fn negate_index(&mut self, index: usize)
fn clear_bits(&mut self)
fn assign_random(
&mut self,
bit_count: usize,
random_number_generator: &mut impl RngExt,
)where
BorrowedSelf: BitLength,
§impl<Bits, Other, BorrowedSelf, BorrowedOther> BitwisePairMutViaBorrow<Other, BorrowedSelf, BorrowedOther> for Bits
impl<Bits, Other, BorrowedSelf, BorrowedOther> BitwisePairMutViaBorrow<Other, BorrowedSelf, BorrowedOther> for Bits
fn assign(&mut self, other: &Other)
fn bitxor_assign(&mut self, other: &Other)
fn bitand_assign(&mut self, other: &Other)
fn bitor_assign(&mut self, other: &Other)
§impl<T, Other, BorrowedSelf, BorrowedOther> BitwisePairViaBorrow<Other, BorrowedSelf, BorrowedOther> for T
impl<T, Other, BorrowedSelf, BorrowedOther> BitwisePairViaBorrow<Other, BorrowedSelf, BorrowedOther> for T
§impl<T, BorrowedSelf> BitwiseViaBorrow<BorrowedSelf> for T
impl<T, BorrowedSelf> BitwiseViaBorrow<BorrowedSelf> for T
fn index(&self, index: usize) -> bool
fn weight(&self) -> usize
fn parity(&self) -> bool
fn is_zero(&self) -> bool
fn is_unit(&self, index: usize) -> bool
fn support<'a>(&'a self) -> impl SortedIteratorwhere
BorrowedSelf: 'a,
fn max_support(&self) -> Option<usize>
fn min_support(&self) -> Option<usize>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§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();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§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();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§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();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§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();§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.
§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);§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].