pub fn run_sub_graph(
        &mut self,
        name: impl Into<Cow<'static, str>>,
        inputs: Vec<SlotValue>,
    ) -> Result<(), RunSubGraphError> {
        let name = name.into();
        let sub_graph = self
            .graph
            .get_sub_graph(&name)
            .ok_or_else(|| RunSubGraphError::MissingSubGraph(name.clone()))?;
        if let Some(input_node) = sub_graph.input_node() {
            for (i, input_slot) in input_node.input_slots.iter().enumerate() {
                if let Some(input_value) = inputs.get(i) {
                    if input_slot.slot_type != input_value.slot_type() {
                        return Err(RunSubGraphError::MismatchedInputSlotType {
                            graph_name: name,
                            slot_index: i,
                            actual: input_value.slot_type(),
                            expected: input_slot.slot_type,
                            label: input_slot.name.clone().into(),
                        });
                    }
                } else {
                    return Err(RunSubGraphError::MissingInput {
                        slot_index: i,
                        slot_name: input_slot.name.clone(),
                        graph_name: name,
                    });
                }
            }
        } else if !inputs.is_empty() {
            return Err(RunSubGraphError::SubGraphHasNoInputs(name));
        }

        self.run_sub_graphs.push(RunSubGraph { name, inputs });

        Ok(())
    }
/// Queues up a sub graph for execution after the node has finished running.
Queues up a sub graph for execution after the node has finished running.
Queues up a sub graph for execution after the node has finished running .
pub fn run_sub_graph(
        &mut self,
        name: impl Into<Cow<'static, str>>,
        inputs: Vec<SlotValue>,
    ) -> Result<(), RunSubGraphError> {
        let name = name.into();
        let sub_graph = self
            .graph
            .get_sub_graph(&name)
            .ok_or_else(|| RunSubGraphError::MissingSubGraph(name.clone()))?;
        if let Some(input_node) = sub_graph.input_node() {
            for (i, input_slot) in input_node.input_slots.iter().enumerate() {
                if let Some(input_value) = inputs.get(i) {
                    if input_slot.slot_type != input_value.slot_type() {
                        return Err(RunSubGraphError::MismatchedInputSlotType {
                            graph_name: name,
                            slot_index: i,
                            actual: input_value.slot_type(),
                            expected: input_slot.slot_type,
                            label: input_slot.name.clone().into(),
                        });
                    }
                } else {
                    return Err(RunSubGraphError::MissingInput {
                        slot_index: i,
                        slot_name: input_slot.name.clone(),
                        graph_name: name,
                    });
                }
            }
        } else if !inputs.is_empty() {
            return Err(RunSubGraphError::SubGraphHasNoInputs(name));
        }
        self.run_sub_graphs.push(RunSubGraph { name, inputs });
        Ok(())
    }
pub fn run_sub_graph ( & mut self , name : impl Into < Cow < ' static , str > > , inputs : Vec < SlotValue > , ) -> Result < ( ) , RunSubGraphError > { let name = name . into ( ) ; let sub_graph = self . graph . get_sub_graph ( & name ) . ok_or_else ( | | RunSubGraphError :: MissingSubGraph ( name . clone ( ) ) ) ? ; if let Some ( input_node ) = sub_graph . input_node ( ) { for ( i , input_slot ) in input_node . input_slots . iter ( ) . enumerate ( ) { if let Some ( input_value ) = inputs . get ( i ) { if input_slot . slot_type != input_value . slot_type ( ) { return Err ( RunSubGraphError :: MismatchedInputSlotType { graph_name : name , slot_index : i , actual : input_value . slot_type ( ) , expected : input_slot . slot_type , label : input_slot . name . clone ( ) . into ( ) , } ) ; } } else { return Err ( RunSubGraphError :: MissingInput { slot_index : i , slot_name : input_slot . name . clone ( ) , graph_name : name , } ) ; } } } else if ! inputs . is_empty ( ) { return Err ( RunSubGraphError :: SubGraphHasNoInputs ( name ) ) ; } self . run_sub_graphs . push ( RunSubGraph { name , inputs } ) ; Ok ( ( ) ) }
Queues up a sub graph for execution after the node has finished running.
Queues up a sub graph for execution after the node has finished running .
&mut self
name
impl Into<Cow<'static, str>>
inputs
Vec<SlotValue>
&mut self
name
impl Into<Cow<'static, str>>
inputs
Vec<SlotValue>