Skip to content

Commit 01cbd50

Browse files
Merge pull request #66 from code0-tech/57-nats-execution
NATS Execution
2 parents 2a60ab9 + a122b66 commit 01cbd50

File tree

8 files changed

+527
-1965
lines changed

8 files changed

+527
-1965
lines changed

Cargo.lock

Lines changed: 368 additions & 1260 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ version = "0.1.0"
44
edition = "2024"
55

66
[dependencies]
7-
code0-flow = { version = "0.0.13" }
8-
tucana = { version = "0.0.28", features = ["aquila"] }
9-
lapin = "2.5.3"
7+
code0-flow = { version = "0.0.14" }
8+
tucana = { version = "0.0.33" }
109
serde = "1.0.219"
1110
serde_json = "1.0.140"
1211
tokio = { version = "1.44.1", features = ["rt-multi-thread"] }
13-
toml = "0.9.0"
1412
log = "0.4.27"
1513
futures-lite = "2.6.0"
1614
rand = "0.9.1"
1715
base64 = "0.22.1"
1816
env_logger = "0.11.8"
17+
async-nats = "0.42.0"
18+
prost = "0.14.1"
1919

2020
[dev-dependencies]
2121
tempfile = "3.19.1"

src/implementation/control.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
use tucana::shared::Value;
2+
3+
use crate::{context::Context, error::RuntimeError, registry::HandlerFn};
4+
5+
pub fn collect_control_functions() -> Vec<(&'static str, HandlerFn)> {
6+
vec![
7+
("std::control::break", r#break),
8+
("std::control::return", r#return),
9+
]
10+
}
11+
12+
fn r#break(values: &[Value], _ctx: &mut Context) -> Result<Value, RuntimeError> {
13+
let [Value { kind }] = values else {
14+
return Err(RuntimeError::simple(
15+
"InvalidArgumentRuntimeError",
16+
format!("Expected one generic value but received {:?}", values),
17+
));
18+
};
19+
20+
Ok(Value { kind: kind.clone() })
21+
}
22+
23+
fn r#return(values: &[Value], _ctx: &mut Context) -> Result<Value, RuntimeError> {
24+
let [Value { kind }] = values else {
25+
return Err(RuntimeError::simple(
26+
"InvalidArgumentRuntimeError",
27+
format!("Expected one generic value but received {:?}", values),
28+
));
29+
};
30+
31+
Ok(Value { kind: kind.clone() })
32+
}

src/implementation/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use crate::registry::HandlerFn;
22

33
pub mod array;
44
pub mod boolean;
5+
mod control;
56
pub mod number;
67
pub mod object;
78
pub mod text;
@@ -14,6 +15,7 @@ pub fn collect() -> Vec<(&'static str, HandlerFn)> {
1415
result.extend(boolean::collect_boolean_functions());
1516
result.extend(text::collect_text_functions());
1617
result.extend(object::collect_object_functions());
18+
result.extend(control::collect_control_functions());
1719

1820
result
1921
}

src/locale/code.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)