pub enum CircuitEvent {
PushRegion {
name: Cow<'static, str>,
location: OperatorLocation,
},
PopRegion,
Operator {
node_id: GlobalNodeId,
name: Cow<'static, str>,
location: OperatorLocation,
},
StrictOperatorOutput {
node_id: GlobalNodeId,
name: Cow<'static, str>,
location: OperatorLocation,
},
StrictOperatorInput {
node_id: GlobalNodeId,
output_node_id: NodeId,
},
Subcircuit {
node_id: GlobalNodeId,
iterative: bool,
},
SubcircuitComplete {
node_id: GlobalNodeId,
},
Edge {
kind: EdgeKind,
from: GlobalNodeId,
to: GlobalNodeId,
},
}
Expand description
Events related to circuit construction. A handler listening to these events should be able to reconstruct complete circuit topology, including operators, nested circuits, and streams connecting them.
Variants§
PushRegion
Create a sub-region.
Fields
location: OperatorLocation
The region’s source location
PopRegion
Subregion complete.
Operator
A new regular (non-strict) operator is added to the circuit.
Fields
node_id: GlobalNodeId
Global id of the new operator.
location: OperatorLocation
The operator’s source location
StrictOperatorOutput
The output half of a strict
operator.
A strict operator is activated twice in each clock cycle: first, its
output computed based on previous inputs is read; second, a new
input for the current cycle is pushed to the operator. These
activations are modeled as separate circuit nodes. The
StrictOperatorOutput
event is emitted first, when the output node is
created.
StrictOperatorInput
The input half of a strict operator is added to the circuit. This event is triggered when the circuit builder connects an input stream to the strict operator. The output node already exists at this point.
Fields
node_id: GlobalNodeId
Node id of the input half.
Subcircuit
A new nested circuit is added to the circuit.
Fields
node_id: GlobalNodeId
Global id of the nested circuit.
SubcircuitComplete
Nested circuit has been fully populated.
Fields
node_id: GlobalNodeId
Global id of the nested circuit.
Edge
A new edge between nodes connected as producer and consumer to the same stream. Producer and consumer nodes can be located in different subcircuits.
Fields
from: GlobalNodeId
Global id of the producer operator that writes to the stream.
to: GlobalNodeId
Global id of an operator or subcircuit that reads values from the stream.
Implementations§
Source§impl CircuitEvent
impl CircuitEvent
Sourcepub fn push_region_static(
name: &'static str,
location: OperatorLocation,
) -> Self
pub fn push_region_static( name: &'static str, location: OperatorLocation, ) -> Self
Create a CircuitEvent::PushRegion
event instance.
Sourcepub fn push_region(name: &str, location: OperatorLocation) -> Self
pub fn push_region(name: &str, location: OperatorLocation) -> Self
Create a CircuitEvent::PushRegion
event instance.
Sourcepub fn pop_region() -> Self
pub fn pop_region() -> Self
Create a CircuitEvent::PopRegion
event.
Sourcepub fn operator(
node_id: GlobalNodeId,
name: Cow<'static, str>,
location: OperatorLocation,
) -> Self
pub fn operator( node_id: GlobalNodeId, name: Cow<'static, str>, location: OperatorLocation, ) -> Self
Create a CircuitEvent::Operator
event instance.
Sourcepub fn strict_operator_output(
node_id: GlobalNodeId,
name: Cow<'static, str>,
location: OperatorLocation,
) -> Self
pub fn strict_operator_output( node_id: GlobalNodeId, name: Cow<'static, str>, location: OperatorLocation, ) -> Self
Create a CircuitEvent::StrictOperatorOutput
event instance.
Sourcepub fn strict_operator_input(
node_id: GlobalNodeId,
output_node_id: NodeId,
) -> Self
pub fn strict_operator_input( node_id: GlobalNodeId, output_node_id: NodeId, ) -> Self
Create a CircuitEvent::StrictOperatorInput
event instance.
Sourcepub fn subcircuit(node_id: GlobalNodeId, iterative: bool) -> Self
pub fn subcircuit(node_id: GlobalNodeId, iterative: bool) -> Self
Create a CircuitEvent::Subcircuit
event instance.
Sourcepub fn subcircuit_complete(node_id: GlobalNodeId) -> Self
pub fn subcircuit_complete(node_id: GlobalNodeId) -> Self
Create a CircuitEvent::SubcircuitComplete
event instance.
Sourcepub fn stream(
from: GlobalNodeId,
to: GlobalNodeId,
ownership_preference: OwnershipPreference,
) -> Self
pub fn stream( from: GlobalNodeId, to: GlobalNodeId, ownership_preference: OwnershipPreference, ) -> Self
Create a CircuitEvent::Edge
event instance.
Sourcepub fn dependency(from: GlobalNodeId, to: GlobalNodeId) -> Self
pub fn dependency(from: GlobalNodeId, to: GlobalNodeId) -> Self
Create a CircuitEvent::Edge
event instance.
Sourcepub fn is_strict_input_event(&self) -> bool
pub fn is_strict_input_event(&self) -> bool
true
if self
is a CircuitEvent::StrictOperatorInput
Sourcepub fn is_strict_output_event(&self) -> bool
pub fn is_strict_output_event(&self) -> bool
true
if self
is a CircuitEvent::StrictOperatorOutput
Sourcepub fn is_operator_event(&self) -> bool
pub fn is_operator_event(&self) -> bool
true
if self
is a CircuitEvent::Operator
Sourcepub fn is_subcircuit_event(&self) -> bool
pub fn is_subcircuit_event(&self) -> bool
true
if self
is a CircuitEvent::Subcircuit
Sourcepub fn is_iterative_subcircuit_event(&self) -> bool
pub fn is_iterative_subcircuit_event(&self) -> bool
true
if self
is a CircuitEvent::Subcircuit
and self.iterative
is true
.
Sourcepub fn is_edge_event(&self) -> bool
pub fn is_edge_event(&self) -> bool
true
if self
is a CircuitEvent::Edge
Sourcepub fn is_node_event(&self) -> bool
pub fn is_node_event(&self) -> bool
true
if self
is one of events related to nodes:
CircuitEvent::Operator
, CircuitEvent::StrictOperatorOutput
,
CircuitEvent::StrictOperatorInput
, CircuitEvent::Subcircuit
,
or CircuitEvent::SubcircuitComplete
.
Sourcepub fn is_new_node_event(&self) -> bool
pub fn is_new_node_event(&self) -> bool
true
if self
is one of the node creation events:
CircuitEvent::Operator
, CircuitEvent::StrictOperatorOutput
,
CircuitEvent::StrictOperatorInput
, or CircuitEvent::Subcircuit
.
Sourcepub fn node_id(&self) -> Option<&GlobalNodeId>
pub fn node_id(&self) -> Option<&GlobalNodeId>
If self
is one of the node creation events, returns self.node_id
.
Sourcepub fn node_name(&self) -> Option<&Cow<'static, str>>
pub fn node_name(&self) -> Option<&Cow<'static, str>>
If self
is a CircuitEvent::Operator
or
CircuitEvent::StrictOperatorOutput
, returns self.name
.
pub fn location(&self) -> OperatorLocation
Sourcepub fn output_node_id(&self) -> Option<NodeId>
pub fn output_node_id(&self) -> Option<NodeId>
If self
is a CircuitEvent::StrictOperatorInput
, returns
self.output_node_id
.
Sourcepub fn from(&self) -> Option<&GlobalNodeId>
pub fn from(&self) -> Option<&GlobalNodeId>
If self
is a CircuitEvent::Edge
, returns self.from
.
Sourcepub fn to(&self) -> Option<&GlobalNodeId>
pub fn to(&self) -> Option<&GlobalNodeId>
If self
is a CircuitEvent::Edge
, returns self.to
.
Trait Implementations§
Source§impl Clone for CircuitEvent
impl Clone for CircuitEvent
Source§fn clone(&self) -> CircuitEvent
fn clone(&self) -> CircuitEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CircuitEvent
impl Debug for CircuitEvent
Source§impl Display for CircuitEvent
impl Display for CircuitEvent
Source§impl Hash for CircuitEvent
impl Hash for CircuitEvent
Source§impl PartialEq for CircuitEvent
impl PartialEq for CircuitEvent
impl Eq for CircuitEvent
impl StructuralPartialEq for CircuitEvent
Auto Trait Implementations§
impl Freeze for CircuitEvent
impl RefUnwindSafe for CircuitEvent
impl Send for CircuitEvent
impl Sync for CircuitEvent
impl Unpin for CircuitEvent
impl UnwindSafe for CircuitEvent
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CustomError for T
impl<T> CustomError for T
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.