Skip to content

Commit 6e2dff3

Browse files
committed
feat: replaced rabbitmq with nats
1 parent ab56467 commit 6e2dff3

File tree

6 files changed

+155
-701
lines changed

6 files changed

+155
-701
lines changed

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)