pub struct InferenceGraph {
pub nodes: Vec<NodeLatency>,
pub edges: Vec<(NodeId, NodeId)>,
}Expand description
A lightweight Directed Acyclic Graph (DAG) of inference nodes.
Nodes are added in order and receive consecutive NodeIds starting from
zero. Edges encode data-flow dependencies: edge (from, to) means “node
from must execute before node to”.
Fields§
§nodes: Vec<NodeLatency>Per-node latency annotations; index == NodeId.
edges: Vec<(NodeId, NodeId)>Directed edges (from, to) — i.e. from → to.
Implementations§
Source§impl InferenceGraph
impl InferenceGraph
Sourcepub fn add_node(&mut self, latency: NodeLatency) -> NodeId
pub fn add_node(&mut self, latency: NodeLatency) -> NodeId
Add a node with the given latency annotation and return its NodeId.
Sourcepub fn add_edge(
&mut self,
from: NodeId,
to: NodeId,
) -> Result<(), CriticalPathError>
pub fn add_edge( &mut self, from: NodeId, to: NodeId, ) -> Result<(), CriticalPathError>
Add a directed edge from → to.
Returns CriticalPathError::InvalidNode if either node index is out
of range.
Trait Implementations§
Source§impl Clone for InferenceGraph
impl Clone for InferenceGraph
Source§fn clone(&self) -> InferenceGraph
fn clone(&self) -> InferenceGraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InferenceGraph
impl Debug for InferenceGraph
Source§impl Default for InferenceGraph
impl Default for InferenceGraph
Source§fn default() -> InferenceGraph
fn default() -> InferenceGraph
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InferenceGraph
impl RefUnwindSafe for InferenceGraph
impl Send for InferenceGraph
impl Sync for InferenceGraph
impl Unpin for InferenceGraph
impl UnsafeUnpin for InferenceGraph
impl UnwindSafe for InferenceGraph
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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