pub struct BranchSpec { /* private fields */ }Expand description
The spec for a branch node: routes on a typed output.
Implementations§
Source§impl BranchSpec
impl BranchSpec
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Starts a branch spec with its required node id. Cases are added with
case.
Sourcepub fn name(self, name: impl Into<String>) -> Self
pub fn name(self, name: impl Into<String>) -> Self
Sets a short display label for this node. Bounds (a 64-character cap,
not empty or all whitespace) are checked by [crate::validate], not
here; see crate::document’s “The optional node display name”
section for why this field, unlike an agent’s own name, is part of
the graph’s content hash.
Sourcepub fn on(self, on: impl Into<String>) -> Self
pub fn on(self, on: impl Into<String>) -> Self
Sets the opaque reference to the typed value the branch routes on.
Sourcepub fn agent_hash(self, agent_hash: impl Into<String>) -> Self
pub fn agent_hash(self, agent_hash: impl Into<String>) -> Self
Sets the sha256:<64 hex> hash of the agent that decides a
BranchCondition::ModelDecision case. Required by [crate::validate]
on any branch that carries a model-decision case; the hash form is
checked there, not here.
Sourcepub fn case(self, name: impl Into<String>, when: BranchCondition) -> Self
pub fn case(self, name: impl Into<String>, when: BranchCondition) -> Self
Adds a named case selected by the given condition. The route it realizes
is a labeled_edge whose label matches the
case name.
Trait Implementations§
Source§impl Clone for BranchSpec
impl Clone for BranchSpec
Source§fn clone(&self) -> BranchSpec
fn clone(&self) -> BranchSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more