ops_mel/
string.rs

1use melodium_core::*;
2use melodium_macro::{check, mel_function, mel_treatment};
3
4/// Return whether `a` is equal to `b`
5#[mel_function]
6pub fn equal(a: string, b: string) -> bool {
7    a == b
8}
9
10/// Return whether `a` is different `b`
11#[mel_function]
12pub fn not_equal(a: string, b: string) -> bool {
13    a != b
14}
15
16/// Determine whether `a` is equal to `b`
17#[mel_treatment(
18    input a Stream<string>
19    input b Stream<string>
20    output result Stream<bool>
21)]
22pub async fn equal() {
23    while let (Ok(a), Ok(b)) = (a.recv_one_string().await, b.recv_one_string().await) {
24        check!(result.send_one_bool(a == b).await)
25    }
26}
27
28/// Determine whether `a` is different from `b`
29#[mel_treatment(
30    input a Stream<string>
31    input b Stream<string>
32    output result Stream<bool>
33)]
34pub async fn not_equal() {
35    while let (Ok(a), Ok(b)) = (a.recv_one_string().await, b.recv_one_string().await) {
36        check!(result.send_one_bool(a != b).await)
37    }
38}