MCPcopy Create free account
hub / github.com/YuminosukeSato/ironkernel / finalize_callable_outcome

Function finalize_callable_outcome

src/python/py_runtime.rs:93–122  ·  view source on GitHub ↗
(
    background: &CallableTask,
    out_channel: Option<Channel>,
    outcome: CallableOutcome,
)

Source from the content-addressed store, hash-verified

91}
92
93fn finalize_callable_outcome(
94 background: &CallableTask,
95 out_channel: Option<Channel>,
96 outcome: CallableOutcome,
97) {
98 match outcome {
99 CallableOutcome::Cancelled => {}
100 CallableOutcome::Failed(message) => {
101 if !background.is_done() {
102 background.fail(message);
103 }
104 }
105 CallableOutcome::Ready {
106 value,
107 delivery_buffer,
108 } => {
109 if background.is_done() {
110 return;
111 }
112 if let Some(channel) = out_channel {
113 match channel.send(delivery_buffer.expect("buffer required for delivery")) {
114 Ok(()) => background.complete(value),
115 Err(err) => background.fail(err.to_string()),
116 }
117 } else {
118 background.complete(value);
119 }
120 }
121 }
122}
123
124/// The runtime module exposed to Python.
125#[pyclass(name = "_RuntimeModule")]

Calls 4

is_doneMethod · 0.45
failMethod · 0.45
sendMethod · 0.45
completeMethod · 0.45